kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

opt_10_packed_local_member.c (633B)


      1 /* A folded local operand is a typed view into semantic frame storage, not a
      2  * scalar spill home.  In particular, a member of a packed local can have a
      3  * natural type alignment greater than the aggregate frame slot alignment.
      4  * The access is valid (and deliberately unaligned); O1 must not reject the
      5  * OPK_LOCAL view while lowering physical MIR. */
      6 typedef struct __attribute__((packed)) Packed {
      7   unsigned value;
      8 } Packed;
      9 
     10 __attribute__((noinline)) static unsigned packed_roundtrip(unsigned value) {
     11   Packed local;
     12   local.value = value;
     13   return local.value;
     14 }
     15 
     16 int test_main(void) { return packed_roundtrip(42u) != 42u; }