================
@@ -101,9 +101,17 @@ class SymbolConjured : public SymbolData {
 
   // It might return null.
   const Stmt *getStmt() const {
+    if (const auto *Parent = Elem.getParent()) {
+      // Sometimes the CFG element is invalid, avoid dereferencing it.
+      if (Elem.getIndexInBlock() >= Parent->size())
+        return nullptr;
----------------
steakhal wrote:

WHen can  the CFG element invalid? Where is it coming from?
My argument is that the CFG element should be always valid, and if it's not 
then my gut feeling is that that is because the CFG element is uninitialized. 
And I'm dreading uninitialized values because they are really hard to track 
down, and this is why I'm pushing back against this change to much just to be 
on the safe side.

https://github.com/llvm/llvm-project/pull/139980
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to