1! { dg-do run }
2!
3! Check that the error is properly diagnosed and the strings are correctly padded.
4!
5integer, allocatable :: A, B(:)
6integer :: stat
7character(len=5) :: sstr
8character(len=200) :: str
9
10str = repeat('X', len(str))
11deallocate(a, stat=stat, errmsg=str)
12!print *, stat, trim(str)
13if (stat == 0 .or. str /= "Attempt to deallocate an unallocated object") STOP 1
14
15str = repeat('Y', len(str))
16deallocate(b, stat=stat, errmsg=str)
17!print *, stat, trim(str)
18if (stat == 0 .or. str /= "Attempt to deallocate an unallocated object") STOP 2
19
20sstr = repeat('Q', len(sstr))
21deallocate(a, stat=stat, errmsg=sstr)
22!print *, stat, trim(sstr)
23if (stat == 0 .or. sstr /= "Attem") STOP 3
24
25sstr = repeat('P', len(sstr))
26deallocate(b, stat=stat, errmsg=sstr)
27!print *, stat, trim(sstr)
28if (stat == 0 .or. sstr /= "Attem") STOP 4
29
30end
31