[flang-commits] [flang] [flang] Don't crash in expression analysis after detecting error (PR #91234)

via flang-commits flang-commits at lists.llvm.org
Mon May 6 09:23:51 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-semantics

Author: Peter Klausler (klausler)

<details>
<summary>Changes</summary>

Avoid calling GetArguments() if a fatal error has been detected.

Fixes https://github.com/llvm/llvm-project/issues/91114.

---
Full diff: https://github.com/llvm/llvm-project/pull/91234.diff


1 Files Affected:

- (modified) flang/lib/Semantics/expression.cpp (+3-1) 


``````````diff
diff --git a/flang/lib/Semantics/expression.cpp b/flang/lib/Semantics/expression.cpp
index f677973ca2753b..e7f137232463dd 100644
--- a/flang/lib/Semantics/expression.cpp
+++ b/flang/lib/Semantics/expression.cpp
@@ -4210,7 +4210,9 @@ MaybeExpr ArgumentAnalyzer::TryDefinedOp(
     if (Symbol *symbol{scope.FindSymbol(oprName)}) {
       anyPossibilities = true;
       parser::Name name{symbol->name(), symbol};
-      result = context_.AnalyzeDefinedOp(name, GetActuals());
+      if (!fatalErrors_) {
+        result = context_.AnalyzeDefinedOp(name, GetActuals());
+      }
       if (result) {
         inaccessible = CheckAccessibleSymbol(scope, *symbol);
         if (inaccessible) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/91234


More information about the flang-commits mailing list