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

via flang-commits flang-commits at lists.llvm.org
Thu May 9 10:43:28 PDT 2024


Author: Peter Klausler
Date: 2024-05-09T10:43:25-07:00
New Revision: 7b25ddc559fad078b605c7b3c0d9f4a35a973a52

URL: https://github.com/llvm/llvm-project/commit/7b25ddc559fad078b605c7b3c0d9f4a35a973a52
DIFF: https://github.com/llvm/llvm-project/commit/7b25ddc559fad078b605c7b3c0d9f4a35a973a52.diff

LOG: [flang] Don't crash in expression analysis after detecting error (#91234)

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

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

Added: 
    

Modified: 
    flang/lib/Semantics/expression.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/expression.cpp b/flang/lib/Semantics/expression.cpp
index ff30b3ab831c..c503ea3f0246 100644
--- a/flang/lib/Semantics/expression.cpp
+++ b/flang/lib/Semantics/expression.cpp
@@ -4310,7 +4310,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) {


        


More information about the flang-commits mailing list