[flang-commits] [flang] 6f55c80 - [flang] Fix crash in fuzzer-generated error test. (#122199)
via flang-commits
flang-commits at lists.llvm.org
Tue Jan 14 10:41:46 PST 2025
Author: Peter Klausler
Date: 2025-01-14T10:41:42-08:00
New Revision: 6f55c8068f42f391dd38d7c711ed7c639b01d72c
URL: https://github.com/llvm/llvm-project/commit/6f55c8068f42f391dd38d7c711ed7c639b01d72c
DIFF: https://github.com/llvm/llvm-project/commit/6f55c8068f42f391dd38d7c711ed7c639b01d72c.diff
LOG: [flang] Fix crash in fuzzer-generated error test. (#122199)
Fixes https://github.com/llvm/llvm-project/issues/121973.
Added:
flang/test/Semantics/bug121973.f90
Modified:
flang/lib/Semantics/resolve-names.cpp
Removed:
################################################################################
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index c1663082f86d42..1b0fb02160123b 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -8215,6 +8215,9 @@ bool DeclarationVisitor::CheckForHostAssociatedImplicit(
}
bool DeclarationVisitor::IsUplevelReference(const Symbol &symbol) {
+ if (symbol.owner().IsTopLevel()) {
+ return false;
+ }
const Scope &symbolUnit{GetProgramUnitContaining(symbol)};
if (symbolUnit == GetProgramUnitContaining(currScope())) {
return false;
diff --git a/flang/test/Semantics/bug121973.f90 b/flang/test/Semantics/bug121973.f90
new file mode 100644
index 00000000000000..0ae04c808e416b
--- /dev/null
+++ b/flang/test/Semantics/bug121973.f90
@@ -0,0 +1,9 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+subroutine s()
+ real(8) :: a
+ !ERROR: COMPLEX(KIND=128) is not a supported type
+ complex(128) :: x
+ a(i)=a + ((i)+1) + 3.14
+ !ERROR: 'a' has not been declared as an array or pointer-valued function
+ a()=z(a * a + n-1 - x) + i((/0,0,0,0,0,0,0,0,0,0/)) + 8
+end
More information about the flang-commits
mailing list