kit

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

loop.c (578B)


      1 /* Control flow: a counted loop (volatile bound defeats constant folding so the
      2  * loop body and back-edge survive). Codegen resolves the loop's branches
      3  * within the function (no relocs); the symbolizer synthesizes `Lcf_` labels so
      4  * `-S` is re-assemblable. L0 (decode) and L2 (re-assemble + execute) cover
      5  * this; L1 is auto-skipped pending assembler same-section branch relaxation
      6  * (P2, doc/ASM_ROUNDTRIP_TESTING.md). Exit code: (0+..+8) + 6 = 42. */
      7 int test_main(void) {
      8   volatile int n = 9;
      9   int sum = 0;
     10   for (int i = 0; i < n; ++i) sum += i;
     11   return sum + 6;
     12 }