2018-09-30 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / allocate_with_source_19.f08
blobff8451093a842c956e7a34d6aa5ab0173d07f62c
1 ! { dg-do compile }
2 ! { dg-options -std=f2008 }
4 ! Contributed by mrestelli@gmail.com
5 ! Check that instead of an ICE the error message is emitted.
7 module m
8  implicit none
9 contains
11  subroutine s()
12   real, allocatable :: x(:)
13   real :: y
15    y = 5.0
16    ! x either needs an array spec, or y needs to be an array.
17    allocate( x , source=y ) ! { dg-error "Array specification or array-valued SOURCE= expression required in ALLOCATE statement" }
19  end subroutine s
21 end module m