Debian Codegraph @

gcc/testsuite/gfortran.dg/alloc_comp_constraint_5.f90

raw
1 ! { dg-do compile }
2 ! Check that ALLOCATABLE components aren't allowed to the right of a non-zero
3 ! rank part reference.
4 program test
5
6 implicit none
7 type :: foo
8 real, allocatable :: bar(:)
9 end type foo
10 type(foo), target :: x(3)
11 integer :: i
12 real, pointer :: p(:)
13
14 allocate(x(:)%bar(5))! { dg-error "must not have the ALLOCATABLE attribute" }
15 x(:)%bar(1) = 1.0 ! { dg-error "must not have the ALLOCATABLE attribute" }
16 p => x(:)%bar(1) ! { dg-error "must not have the ALLOCATABLE attribute" }
17
18 end program test