2008-07-06 Kai Tietz <kai.tietz@onevision.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / data_constraints_1.f90
blobbcf23ba34acf5d14f61859d4c20a405fd682796f
1 ! { dg-do compile }
2 ! Tests standard indepedendent constraints for variables in a data statement
4 ! Contributed by Paul Thomas <pault@gcc.gnu.org>
6 module global
7 integer n
8 end module global
10 use global
11 integer q
12 data n /0/ ! { dg-error "Cannot change attributes" }
13 n = 1
14 n = foo (n)
15 contains
16 function foo (m) result (bar)
17 integer p (m), bar
18 integer, allocatable :: l(:)
19 allocate (l(1))
20 data l /42/ ! { dg-error "conflicts with ALLOCATABLE" }
21 data p(1) /1/ ! { dg-error "non-constant array in DATA" }
22 data q /1/ ! { dg-error "Host associated variable" }
23 data m /1/ ! { dg-error "conflicts with DUMMY attribute" }
24 data bar /99/ ! { dg-error "conflicts with RESULT" }
25 end function foo
26 function foobar ()
27 integer foobar
28 data foobar /0/ ! { dg-error "conflicts with FUNCTION" }
29 end function foobar
30 end
32 ! { dg-final { cleanup-modules "global" } }