[flang-commits] [flang] 66a871b - [flang] Fix crash in IsSaved()

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Fri Jun 3 17:00:17 PDT 2022


Author: Peter Klausler
Date: 2022-06-03T17:00:01-07:00
New Revision: 66a871b973c52819ee0758ae3917f2b7b04ccef5

URL: https://github.com/llvm/llvm-project/commit/66a871b973c52819ee0758ae3917f2b7b04ccef5
DIFF: https://github.com/llvm/llvm-project/commit/66a871b973c52819ee0758ae3917f2b7b04ccef5.diff

LOG: [flang] Fix crash in IsSaved()

Code was accessing ProcEntityDetails in a symbol that didn't have them.

Differential Revision: https://reviews.llvm.org/D127011

Added: 
    

Modified: 
    flang/lib/Evaluate/tools.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Evaluate/tools.cpp b/flang/lib/Evaluate/tools.cpp
index 293c91b700502..68faac50cb4eb 100644
--- a/flang/lib/Evaluate/tools.cpp
+++ b/flang/lib/Evaluate/tools.cpp
@@ -1380,7 +1380,7 @@ bool IsSaved(const Symbol &original) {
   } else if (const auto *object{symbol.detailsIf<ObjectEntityDetails>()};
              object && object->init()) {
     return true;
-  } else if (IsProcedurePointer(symbol) &&
+  } else if (IsProcedurePointer(symbol) && symbol.has<ProcEntityDetails>() &&
       symbol.get<ProcEntityDetails>().init()) {
     return true;
   } else if (scope.hasSAVE()) {


        


More information about the flang-commits mailing list