llvm/flang/docs
peter klausler 3265b93363 [flang] Extension: reduced scope for some implied DO loop indices
The index of an implied DO loop in a DATA statement or array
constructor is defined by Fortran 2018 to have scope over its
implied DO loop.  This definition is unfortunate, because it
requires the implied DO loop's bounds expressions to be in the
scope of the index variable.  Consequently, in code like

  integer, parameter :: j = 5
  real, save :: a(5) = [(j, j=1, j)]

the upper bound of the loop is a reference to the index variable,
not the parameter in the enclosing scope.

This patch limits the scope of the index variable to the "body"
of the implied DO loop as one would naturally expect, with a warning.
I would have preferred to make this a hard error, but most Fortran
compilers treat this case as f18 now does.  If the standard
were to be fixed, the warning could be made optional.

Differential Revision: https://reviews.llvm.org/D108595
2021-08-24 09:34:18 -07:00
..
_static
_templates
_themes/llvm-theme
ArrayComposition.md
BijectiveInternalNameUniquing.md
C++17.md
C++style.md
Calls.md
Character.md
CMakeLists.txt
conf.py
ControlFlowGraph.md
Directives.md
DoConcurrent.md
doxygen-mainpage.dox
doxygen.cfg.in
Extensions.md [flang] Extension: reduced scope for some implied DO loop indices 2021-08-24 09:34:18 -07:00
f2018-grammar.md
flang-c-style.el
FlangDriver.md [flang][docs] Document the flang wrapper script 2021-08-06 12:45:32 +00:00
FortranFeatureHistory.md
FortranForCProgrammers.md
FortranIR.md
FortranLLVMTestSuite.md [flang][docs] Minor update to Fortran LLVM Tests-suite docs. 2021-06-28 10:01:29 -05:00
GettingInvolved.md [Flang][Docs] Update meeting URL 2021-07-07 10:35:35 -05:00
ImplementingASemanticCheck.md [flang][driver] Delete f18 (i.e. the old Flang driver) 2021-08-05 12:57:15 +00:00
index.md
Intrinsics.md
IORuntimeInternals.md
LabelResolution.md
ModFiles.md
OpenMP-4.5-grammar.md
OpenMP-semantics.md
OptionComparison.md
Overview.md [flang][driver] Delete f18 (i.e. the old Flang driver) 2021-08-05 12:57:15 +00:00
ParserCombinators.md
Parsing.md
Preprocessing.md
PullRequestChecklist.md
ReleaseNotes.md
RuntimeDescriptor.md
RuntimeTypeInfo.md
Semantics.md