kit

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

opt_04_global_incomplete_array_decay.c (491B)


      1 /* A global address recipe may retain the declaration's incomplete-array type
      2  * even after the initializer completes the object.  MIR only needs the symbol
      3  * address here; requiring a sized referent rejects ordinary array decay. */
      4 static const char* const options[] = {"alpha", "beta", "gamma"};
      5 
      6 static const char* const* compile_options(void) {
      7   return options;
      8 }
      9 
     10 int test_main(void) {
     11   const char* const* p = compile_options();
     12   return p[0][0] == 'a' && p[2][0] == 'g' ? 42 : 1;
     13 }