Debian Codegraph @

gcc/testsuite/gfortran.dg/coarray/allocate_errgmsg.f90

raw
1 ! { dg-do run }
2 !
3 ! Check handling of errmsg.
4 !
5 implicit none
6 integer, allocatable :: a[:], b(:)[:], c, d(:)
7 integer :: stat
8 character(len=300) :: str
9
10 allocate(a[*], b(1)[*], c, d(2), stat=stat)
11
12 str = repeat('X', len(str))
13 allocate(a[*], stat=stat, errmsg=str)
14 !print *, stat, trim(str)
15 if (stat == 0 .or. str /= "Attempt to allocate an allocated object") &
16 STOP 1
17
18 str = repeat('Y', len(str))
19 allocate(b(2)[*], stat=stat, errmsg=str)
20 !print *, stat, trim(str)
21 if (stat == 0 .or. str /= "Attempt to allocate an allocated object") &
22 STOP 2
23
24 str = repeat('Q', len(str))
25 allocate(c, stat=stat, errmsg=str)
26 !print *, stat, trim(str)
27 if (stat == 0 .or. str /= "Attempt to allocate an allocated object") &
28 STOP 3
29
30 str = repeat('P', len(str))
31 allocate(d(3), stat=stat, errmsg=str)
32 !print *, stat, trim(str)
33 if (stat == 0 .or. str /= "Attempt to allocate an allocated object") &
34 STOP 4
35
36 end