kit

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

opt_11_large_local_member_loop.c (570B)


      1 /* A non-encodable member offset used in a loop is lifted into a register.
      2  * Pointer arithmetic keeps that offset register pointer-typed through MIR;
      3  * address synthesis must not reinterpret it as an integer scaled index. */
      4 typedef struct BigLocal {
      5   unsigned char padding[5000];
      6   int value;
      7 } BigLocal;
      8 
      9 __attribute__((noinline)) static int update_large_member(unsigned count) {
     10   BigLocal local;
     11   unsigned i;
     12   local.value = 0;
     13   for (i = 0; i < count; ++i) local.value = 42;
     14   return local.value;
     15 }
     16 
     17 int test_main(void) { return update_large_member(3) != 42; }