[all-commits] [llvm/llvm-project] 81d047: [flang] Fix construct names on labeled DO (#67622)
Peter Klausler via All-commits
all-commits at lists.llvm.org
Mon Oct 16 17:29:38 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 81d04709f86968431ecab1df12a17279d057daa9
https://github.com/llvm/llvm-project/commit/81d04709f86968431ecab1df12a17279d057daa9
Author: Peter Klausler <35819229+klausler at users.noreply.github.com>
Date: 2023-10-16 (Mon, 16 Oct 2023)
Changed paths:
M flang/include/flang/Parser/parse-tree.h
M flang/lib/Parser/executable-parsers.cpp
M flang/lib/Parser/unparse.cpp
M flang/lib/Semantics/canonicalize-do.cpp
M flang/lib/Semantics/resolve-labels.cpp
A flang/test/Semantics/dosemantics13.f90
A flang/test/Semantics/dosemantics14.f90
Log Message:
-----------
[flang] Fix construct names on labeled DO (#67622)
Fortran requires that a DO construct with a construct name end with an
END DO statement bearing the same name. This is true even if the DO
construct begins with a label DO statement; e.g., "constrName: do 10
j=1,10" must end with "10 end do constrName".
The compiler presently basically ignores construct names that appear on
label DO statements, because only non-label DO statements can be parsed
as DO constructs. This causes us to miss some errors, and (worse) breaks
the usage of the construct name on CYCLE and EXIT statements.
To fix this, this patch changes the parse tree and parser so that a DO
construct name on a putative label DO statement causes it to be parsed
as a "non-label" DO statement... with a label. Only true old-style
labeled DO statements without construct names are now parsed as such.
I did not change the class name NonLabelDoStmt -- it's widely used
across the front-end, and is the name of a production in the standard's
grammar. But now it basically means DoConstructDoStmt.
Fixes https://github.com/llvm/llvm-project/issues/67283.
More information about the All-commits
mailing list