[clang] [CIR] Fix how we lower bitfield constants (PR #210791)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 20 14:02:12 PDT 2026


================
@@ -26,3 +26,9 @@ struct BS { int a : 4; int b : 4; };
 struct BS bs = { -1, 3 };
 // CIR: cir.global external @bs = #cir.const_record<{#cir.int<63> : !u8i, #cir.zero : !cir.array<!u8i x 3>}> : !rec_BS
 // LLVM: @bs = global %struct.BS { i8 63, [3 x i8] zeroinitializer }
+
+struct BA { int a : 24; char c; };
+struct BA ba = { 0x123456, 7 };
----------------
erichkeane wrote:

Huh... this is a bigger ask than I thought :D Looks like we get big-endian wrong in quite a few of the other examples here? I have to spend some time on it.

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


More information about the cfe-commits mailing list