[PATCH] D68115: Zero initialize padding in unions

Vitaly Buka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 26 19:28:50 PDT 2019


vitalybuka marked an inline comment as done.
vitalybuka added inline comments.


================
Comment at: clang/test/CodeGenCXX/designated-init.cpp:68
 };
-// CHECK: @overwrite_padding = global { { i8, i8 } } { { i8, i8 } { i8 3, i8 1 } }
+// CHECK-LE: @overwrite_padding = global { { i8, i8 } } { { i8, i8 } { i8 3, i8 0 } }
+// CHECK-BE: @overwrite_padding = global { { i8, i8, i8, i8 } } { { i8, i8, i8, i8 } { i8 96, i8 0, i8 0, i8 0 } }
----------------
vitalybuka wrote:
> "1->0" here is suspicions
interesting that I can't compile it with GCC as C++

I can compile the following as C with GCC and C/C++ with Clang
struct WithOverwritePaddingWithBitfield overwrite_padding = {{1}, .a.bitfield = 3};
but even without the patch it was 0 in the last byte



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68115/new/

https://reviews.llvm.org/D68115





More information about the cfe-commits mailing list