[clang] 6b8d076 - [clang][bytecode] Return failure for dead non-temporary pointers (#125247)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 31 11:06:32 PST 2025


Author: Timm Baeder
Date: 2025-01-31T20:06:29+01:00
New Revision: 6b8d076b1f0a00341945ed25626eaec099422982

URL: https://github.com/llvm/llvm-project/commit/6b8d076b1f0a00341945ed25626eaec099422982
DIFF: https://github.com/llvm/llvm-project/commit/6b8d076b1f0a00341945ed25626eaec099422982.diff

LOG: [clang][bytecode] Return failure for dead non-temporary pointers (#125247)

... even when we're not performing a lvalue-to-rvalue conversion.

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/EvalEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ByteCode/EvalEmitter.cpp b/clang/lib/AST/ByteCode/EvalEmitter.cpp
index 9763fe89b73742..8134bbf270363e 100644
--- a/clang/lib/AST/ByteCode/EvalEmitter.cpp
+++ b/clang/lib/AST/ByteCode/EvalEmitter.cpp
@@ -174,6 +174,9 @@ template <> bool EvalEmitter::emitRet<PT_Ptr>(const SourceInfo &Info) {
       return false;
     }
   } else {
+    if (!Ptr.isLive() && !Ptr.isTemporary())
+      return false;
+
     EvalResult.setValue(Ptr.toAPValue(Ctx.getASTContext()));
   }
 


        


More information about the cfe-commits mailing list