boot2

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

055-init-local-array.c (452B)


      1 // tests/cc-parse/55-init-local-array.c — local array initializer. §E.7.
      2 //
      3 // Stack-allocated int[3] initialised inside main via a brace list; we
      4 // read element 1 through a manually-decayed pointer. Whatever the
      5 // parser does to lay down the initializer must hit the right offsets
      6 // — here the test asserts that writes to a[0] don't bleed into a[1].
      7 int main(void) {
      8     int a[3] = {10, 20, 30};
      9     int *p = (int *)&a;
     10     return *(p + 1);
     11 }