2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / allocate_alloc_opt_3.f90
blobd8c177f117d18041e89f5b4c0fb3007c1f72c6f5
1 ! { dg-do run }
2 program a
4 implicit none
6 integer n
7 character(len=70) e1
8 character(len=30) e2
9 integer, allocatable :: i(:)
11 e1 = 'No error'
12 allocate(i(4), stat=n, errmsg=e1)
13 if (trim(e1) /= 'No error') call abort
14 deallocate(i)
16 e2 = 'No error'
17 allocate(i(4),stat=n, errmsg=e2)
18 if (trim(e2) /= 'No error') call abort
19 deallocate(i)
22 e1 = 'No error'
23 allocate(i(4), stat=n, errmsg=e1)
24 allocate(i(4), stat=n, errmsg=e1)
25 if (trim(e1) /= 'Attempt to allocate an allocated object') call abort
26 deallocate(i)
28 e2 = 'No error'
29 allocate(i(4), stat=n, errmsg=e2)
30 allocate(i(4), stat=n, errmsg=e2)
31 if (trim(e2) /= 'Attempt to allocate an allocat') call abort
33 end program a