kit

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

glob_const_array.c (420B)


      1 /* glob: read a file-scope `const` global array (lives in .rodata rather than
      2  * .data). Addressing is the same adrp/add :lo12: symbolic pair, but against a
      3  * read-only section symbol, exercising the .rodata data reloc. A volatile index
      4  * defeats folding. Exit: ct[1] + ct[3] = 20 + 22 = 42. */
      5 static const int ct[5] = {18, 20, 8, 22, 16};
      6 int test_main(void) {
      7   volatile int i = 1, j = 3;
      8   return ct[i] + ct[j];
      9 }