OSDN Git Service

2007-12-08 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / data_constraints_1.f90
1 ! { dg-do compile }
2 ! Tests standard indepedendent constraints for variables in a data statement
3 !
4 ! Contributed by Paul Thomas <pault@gcc.gnu.org>
5 !
6   module global
7    integer n
8   end module global
9
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
31
32 ! { dg-final { cleanup-modules "global" } }