xref: /llvm-project/flang/test/Semantics/block-data01.f90 (revision 1c91d9bdea3b6c38e8fbce46ec8181a9c0aa26f8)
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
2! Test BLOCK DATA subprogram (14.3)
3block data foo
4  !ERROR: IMPORT is not allowed in a BLOCK DATA subprogram
5  import
6  real :: pi = asin(-1.0) ! ok
7  !ERROR: An initialized variable in BLOCK DATA must be in a COMMON block
8  integer :: notInCommon = 1
9  integer :: uninitialized ! ok
10  !PORTABILITY: Procedure pointer 'q' should not have an ELEMENTAL intrinsic as its interface
11  !ERROR: 'q' may not appear in a BLOCK DATA subprogram
12  procedure(sin), pointer :: q => cos
13  !ERROR: 'p' may not be a procedure as it is in a COMMON block
14  procedure(sin), pointer :: p => cos
15  common /block/ p, pi
16  !ERROR: An initialized variable in BLOCK DATA must be in a COMMON block
17  integer :: inDataButNotCommon
18  data inDataButNotCommon /1/
19  integer :: inCommonA, inCommonB
20  !ERROR: 'incommona' in COMMON block /a/ must not be storage associated with 'incommonb' in COMMON block /b/ by EQUIVALENCE
21  common /a/ inCommonA, /b/ inCommonB
22  equivalence(inCommonA, inCommonB)
23  integer :: inCommonD, initialized ! ok
24  common /d/ inCommonD
25  equivalence(inCommonD, initialized)
26  data initialized /2/
27  integer :: inCommonE, jarr(2)
28  equivalence(inCommonE, jarr(2))
29  !ERROR: 'incommone' cannot backward-extend COMMON block /e/ via EQUIVALENCE with 'jarr'
30  common /e/ inCommonE
31  equivalence(inCommonF1, inCommonF2)
32  integer :: inCommonF1, inCommonF2
33  !ERROR: 'incommonf1' is storage associated with 'incommonf2' by EQUIVALENCE elsewhere in COMMON block /f/
34  common /f/ inCommonF1, inCommonF2
35  !Regression test for llvm-project/issues/65922 - no error expected
36  common /g/ inCommonG1, inCommonG2
37  real inCommonG1(-9:10), inCommonG2(10), otherG(11)
38  equivalence (inCommonG1(1), otherG), (otherG(11), inCommonG2)
39end block data
40