Skip to content

Commit 6f55c80

Browse files
authored
[flang] Fix crash in fuzzer-generated error test. (#122199)
Fixes #121973.
1 parent c8202db commit 6f55c80

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

flang/lib/Semantics/resolve-names.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8215,6 +8215,9 @@ bool DeclarationVisitor::CheckForHostAssociatedImplicit(
82158215
}
82168216

82178217
bool DeclarationVisitor::IsUplevelReference(const Symbol &symbol) {
8218+
if (symbol.owner().IsTopLevel()) {
8219+
return false;
8220+
}
82188221
const Scope &symbolUnit{GetProgramUnitContaining(symbol)};
82198222
if (symbolUnit == GetProgramUnitContaining(currScope())) {
82208223
return false;

flang/test/Semantics/bug121973.f90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
! RUN: %python %S/test_errors.py %s %flang_fc1
2+
subroutine s()
3+
real(8) :: a
4+
!ERROR: COMPLEX(KIND=128) is not a supported type
5+
complex(128) :: x
6+
a(i)=a + ((i)+1) + 3.14
7+
!ERROR: 'a' has not been declared as an array or pointer-valued function
8+
a()=z(a * a + n-1 - x) + i((/0,0,0,0,0,0,0,0,0,0/)) + 8
9+
end

0 commit comments

Comments
 (0)