llvm-project/flang/test/Semantics/data16.f90
Peter Klausler a9782fead3 [flang] Correct IsHostAssociated() to be true for BLOCK constructs
The predicate IsHostAssocited() was implemented in a way that would
return true only for cases of host association into a module or inner
subprogram.  Technically, the use of a name in a BLOCK construct
that is not declared therein is considered in the Fortran standard
to also be a form of host association, and this matters when doing
error checking on DATA statements.

Differential Revision: https://reviews.llvm.org/D130388
2022-07-23 10:46:54 -07:00

18 lines
527 B
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
program main
contains
subroutine subr
data foo/6.66/ ! implicit declaration of "foo": ok
integer m
!ERROR: Implicitly typed local entity 'n' not allowed in specification expression
real a(n)
!ERROR: Host-associated object 'n' must not be initialized in a DATA statement
data n/123/
block
real b(m)
!ERROR: Host-associated object 'm' must not be initialized in a DATA statement
data m/10/
end block
end subroutine
end program