[clang] [clang][bytecode] Check types when loading values (PR #165385)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 29 04:04:20 PDT 2025


================
@@ -492,6 +506,12 @@ bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) {
     if (!FromT || !ToT)
       return false;
 
+    if (!this->isValidBitCast(CE)) {
+      if (!this->emitInvalidCast(CastKind::ReinterpretLike, /*Fatal=*/false,
+                                 CE))
+        return false;
+    }
----------------
ojhunt wrote:

Perhaps

```suggestion
    if (!this->isValidBitCast(CE) &&
        !this->emitInvalidCast(CastKind::ReinterpretLike, /*Fatal=*/false, CE))
```


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


More information about the cfe-commits mailing list