Debian Codegraph @

gcc/testsuite/gfortran.dg/allocate_zerosize_1.f90

raw
1 ! { dg-do run }
2 program main
3 implicit none
4 real, allocatable :: a(:), b(:,:)
5 integer :: n,m
6 character (len=2) :: one, two
7
8 one = ' 1'
9 two = ' 2'
10
11 allocate (a(1:-1))
12 if (size(a) /= 0) STOP 1
13 deallocate (a)
14
15 allocate (b(1:-1,0:10))
16 if (size(b) /= 0) STOP 2
17 deallocate (b)
18
19 ! Use variables for array bounds. The internal reads
20 ! are there to hide fact that these are actually constant.
21
22 read (unit=one, fmt='(I2)') n
23 allocate (a(n:-1))
24 if (size(a) /= 0) STOP 3
25 deallocate (a)
26
27 read (unit=two, fmt='(I2)') m
28 allocate (b(1:3, m:0))
29 if (size(b) /= 0) STOP 4
30 deallocate (b)
31 end program main