[flang-commits] [PATCH] D145112: [flang] Move check for statement function in BLOCK construct
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Thu Mar 2 13:48:18 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa183668ac6ce: [flang] Move check for statement function in BLOCK construct (authored by klausler).
Changed prior to commit:
https://reviews.llvm.org/D145112?vs=501646&id=501968#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145112/new/
https://reviews.llvm.org/D145112
Files:
flang/lib/Semantics/check-declarations.cpp
flang/lib/Semantics/resolve-names.cpp
flang/test/Semantics/blockconstruct01.f90
Index: flang/test/Semantics/blockconstruct01.f90
===================================================================
--- flang/test/Semantics/blockconstruct01.f90
+++ flang/test/Semantics/blockconstruct01.f90
@@ -56,11 +56,11 @@
end
subroutine s7_c1107
- integer x
+ integer x, arr(1)
inc(x) = x + 1
block
- !ERROR: STATEMENT FUNCTION statement is not allowed in a BLOCK construct
+ !ERROR: A statement function definition may not appear in a BLOCK construct
dec(x) = x - 1
+ arr(x) = x - 1 ! ok
end block
end
-
Index: flang/lib/Semantics/resolve-names.cpp
===================================================================
--- flang/lib/Semantics/resolve-names.cpp
+++ flang/lib/Semantics/resolve-names.cpp
@@ -7692,7 +7692,6 @@
ConstructVisitor::Post(x);
}
bool ResolveNamesVisitor::Pre(const parser::StmtFunctionStmt &x) {
- CheckNotInBlock("STATEMENT FUNCTION"); // C1107
if (HandleStmtFunction(x)) {
return false;
} else {
Index: flang/lib/Semantics/check-declarations.cpp
===================================================================
--- flang/lib/Semantics/check-declarations.cpp
+++ flang/lib/Semantics/check-declarations.cpp
@@ -1054,6 +1054,11 @@
*host);
}
}
+ if (GetProgramUnitOrBlockConstructContaining(symbol).kind() ==
+ Scope::Kind::BlockConstruct) { // C1107
+ messages_.Say(symbol.name(),
+ "A statement function definition may not appear in a BLOCK construct"_err_en_US);
+ }
}
if (IsElementalProcedure(symbol)) {
// See comment on the similar check in CheckProcEntity()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145112.501968.patch
Type: text/x-patch
Size: 1604 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230302/ccdc7710/attachment-0001.bin>
More information about the flang-commits
mailing list