[clang] 498757e - [clang][Interp][NFC] Fix initializing union APValues

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 19 09:31:54 PDT 2024


Author: Timm Bäder
Date: 2024-06-19T18:31:25+02:00
New Revision: 498757e710f39d536633436fe6b4081df73dd6b7

URL: https://github.com/llvm/llvm-project/commit/498757e710f39d536633436fe6b4081df73dd6b7
DIFF: https://github.com/llvm/llvm-project/commit/498757e710f39d536633436fe6b4081df73dd6b7.diff

LOG: [clang][Interp][NFC] Fix initializing union APValues

The InitElem op assumes an array.

Added: 
    

Modified: 
    clang/lib/AST/Interp/ByteCodeExprGen.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index d47f6f23c8bc1..61a7394854d40 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -3507,7 +3507,7 @@ bool ByteCodeExprGen<Emitter>::visitAPValueInitializer(const APValue &Val,
     PrimType T = classifyPrim(RF->Decl->getType());
     if (!this->visitAPValue(F, T, E))
       return false;
-    return this->emitInitElem(T, 0, E);
+    return this->emitInitField(T, RF->Offset, E);
   }
   // TODO: Other types.
 


        


More information about the cfe-commits mailing list