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.
 


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to