2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / deallocate_stat_2.f90
blobe93f446a8180ae3c2e676d0092a6c9fee2dd54f2
1 ! { dg-do run }
3 ! Check that the error is properly diagnosed and the strings are correctly padded.
5 integer, allocatable :: A, B(:)
6 integer :: stat
7 character(len=5) :: sstr
8 character(len=200) :: str
10 str = repeat('X', len(str))
11 deallocate(a, stat=stat, errmsg=str)
12 !print *, stat, trim(str)
13 if (stat == 0 .or. str /= "Attempt to deallocate an unallocated object") call abort()
15 str = repeat('Y', len(str))
16 deallocate(b, stat=stat, errmsg=str)
17 !print *, stat, trim(str)
18 if (stat == 0 .or. str /= "Attempt to deallocate an unallocated object") call abort()
20 sstr = repeat('Q', len(sstr))
21 deallocate(a, stat=stat, errmsg=sstr)
22 !print *, stat, trim(sstr)
23 if (stat == 0 .or. sstr /= "Attem") call abort()
25 sstr = repeat('P', len(sstr))
26 deallocate(b, stat=stat, errmsg=sstr)
27 !print *, stat, trim(sstr)
28 if (stat == 0 .or. sstr /= "Attem") call abort()
30 end