Files
clang-p2996/flang/test/Semantics/block-data01.f90
Emil Kieri 93dca9fbee [flang][test] Fix semantics tests with respect to warnings
Make tests expect the (correctly) emitted warnings using the WARNING
directive. This directive is non-functional now, but will be recognised
by test_errors.py when D125804 is landed. This patch is a preparation
for D125804.

For most tests, we add missing WARNING directives for emitted warnings,
but there are exceptions:

 - for int-literals.f90 and resolve31.f90 we pass -pedantic to the
   frontend driver, so that the expected warnings are actually emitted.

 - for block-data01.f90 and resolve42.f90 we change the tests so that
   warnings, which appear unintentional, are not emitted. While testing
   the warning in question (padding added for alignment in common block)
   would be desired, that is beyond the scope of this patch. This
   warning is target-dependent.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D131987
2022-08-18 19:16:20 +02:00

35 lines
1.4 KiB
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
! Test BLOCK DATA subprogram (14.3)
block data foo
!ERROR: IMPORT is not allowed in a BLOCK DATA subprogram
import
real :: pi = asin(-1.0) ! ok
!ERROR: An initialized variable in BLOCK DATA must be in a COMMON block
integer :: notInCommon = 1
integer :: uninitialized ! ok
!ERROR: 'q' may not appear in a BLOCK DATA subprogram
procedure(sin), pointer :: q => cos
!ERROR: 'p' may not be a procedure as it is in a COMMON block
procedure(sin), pointer :: p => cos
common /block/ p, pi
!ERROR: An initialized variable in BLOCK DATA must be in a COMMON block
integer :: inDataButNotCommon
data inDataButNotCommon /1/
integer :: inCommonA, inCommonB
!ERROR: 'incommona' in COMMON block /a/ must not be storage associated with 'incommonb' in COMMON block /b/ by EQUIVALENCE
common /a/ inCommonA, /b/ inCommonB
equivalence(inCommonA, inCommonB)
integer :: inCommonD, initialized ! ok
common /d/ inCommonD
equivalence(inCommonD, initialized)
data initialized /2/
integer :: inCommonE, jarr(2)
equivalence(inCommonE, jarr(2))
!ERROR: 'incommone' cannot backward-extend COMMON block /e/ via EQUIVALENCE with 'jarr'
common /e/ inCommonE
equivalence(inCommonF1, inCommonF2)
integer :: inCommonF1, inCommonF2
!ERROR: 'incommonf1' is storage associated with 'incommonf2' by EQUIVALENCE elsewhere in COMMON block /f/
common /f/ inCommonF1, inCommonF2
end block data