llvm-project/flang/test/Semantics/common-blocks.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

25 lines
718 B
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
! Test check that enforce that a common block is initialized
! only once in a file.
subroutine init_1
common x, y
common /a/ xa, ya
common /b/ xb, yb
!WARNING: Blank COMMON object 'x' in a DATA statement is not standard
data x /42./, xa /42./, yb/42./
end subroutine
subroutine init_conflict
!ERROR: Multiple initialization of COMMON block //
common x, y
!ERROR: Multiple initialization of COMMON block /a/
common /a/ xa, ya
common /b/ xb, yb
equivalence (yb, yb_eq)
!WARNING: Blank COMMON object 'x' in a DATA statement is not standard
!ERROR: Multiple initialization of COMMON block /b/
data x /66./, xa /66./, yb_eq /66./
end subroutine