2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / common_errors_1.f90
blob0d4e1beb3bf4c70b89616cb433697b22fbe264a7
1 ! { dg-do compile }
2 ! Tests a number of error messages relating to derived type objects
3 ! in common blocks. Originally due to PR 33198
5 subroutine one
6 type a
7 sequence
8 integer :: i = 1
9 end type a
10 type(a) :: t ! { dg-error "Derived type variable .t. in COMMON at ... may not have default initializer" }
11 common /c/ t
12 end
14 subroutine first
15 type a
16 integer :: i
17 integer :: j
18 end type a
19 type(a) :: t ! { dg-error "Derived type variable .t. in COMMON at ... has neither the SEQUENCE nor the BIND.C. attribute" }
20 common /c/ t
21 end
23 subroutine prime
24 type a
25 sequence
26 integer, allocatable :: i(:)
27 integer :: j
28 end type a
29 type(a) :: t ! { dg-error "Derived type variable .t. in COMMON at ... has an ultimate component that is allocatable" }
30 common /c/ t
31 end
33 subroutine source
34 parameter(x=0.) ! { dg-error "COMMON block .x. at ... is used as PARAMETER at ..." }
35 common /x/ i ! { dg-error "COMMON block .x. at ... is used as PARAMETER at ..." }
36 intrinsic sin
37 common /sin/ j ! { dg-error "COMMON block .sin. at ... is also an intrinsic procedure" }
38 end subroutine source