boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

056-init-local-struct.c (368B)


      1 // tests/cc-parse/56-init-local-struct.c — local struct initializer. §E.8.
      2 //
      3 // Stack-allocated struct S { int a; int b; } initialised via brace list.
      4 // Reads field b via pointer arithmetic — member-access codegen is
      5 // owned by Agent 2 (§D).
      6 struct S { int a; int b; };
      7 int main(void) {
      8     struct S s = {3, 9};
      9     int *p = (int *)&s;
     10     return *(p + 1);
     11 }