================
@@ -870,8 +888,20 @@ void CIRRecordLowering::lowerUnion() {
 
   if (layoutSize < getSize(storageType))
     storageType = getByteArrayType(layoutSize);
-  else
+
+  if (nonVirtualBaseType) {
----------------
adams381 wrote:

The divergence is caused by our `appendPaddingBytes` override (lines 198–209): 
for unions it routes tail padding into `unionPadding` rather than `fieldTypes`, 
because the complete-union path needs padding tracked separately from field 
types. Calling `appendPaddingBytes` in the `nonVirtualBaseType=true` path would 
silently stash the padding into `unionPadding` instead of `fieldTypes`, 
corrupting the base-subobject record layout. So the base path pushes the 
padding directly into `fieldTypes` — what `appendPaddingBytes` does in the 
non-union case — rather than calling the override, which would redirect it into 
`unionPadding`.

https://github.com/llvm/llvm-project/pull/201428
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to