2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / allocate_zerosize_1.f90
blobc482ea0f3b331b88e980c19f1d1e5ab9867a7e7d
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
8 one = ' 1'
9 two = ' 2'
11 allocate (a(1:-1))
12 if (size(a) /= 0) call abort
13 deallocate (a)
15 allocate (b(1:-1,0:10))
16 if (size(b) /= 0) call abort
17 deallocate (b)
19 ! Use variables for array bounds. The internal reads
20 ! are there to hide fact that these are actually constant.
22 read (unit=one, fmt='(I2)') n
23 allocate (a(n:-1))
24 if (size(a) /= 0) call abort
25 deallocate (a)
27 read (unit=two, fmt='(I2)') m
28 allocate (b(1:3, m:0))
29 if (size(b) /= 0) call abort
30 deallocate (b)
31 end program main