kit

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

6_7_6_2_vla_file_scope.c (653B)


      1 /* §6.7.6.2¶4: a variable-length array is a block-scope-only feature. A
      2  * file-scope array bound must therefore be an integer constant expression;
      3  * a non-constant bound is a constraint violation.
      4  *
      5  * Regression: the parser used to route a non-constant-looking file-scope
      6  * bound into the block-scope VLA codegen path, which assumes an active
      7  * function frame. With none, it silently miscompiled a bare identifier bound
      8  * and — for a bound whose first token is not the value (here the `?:`) — hung
      9  * the parser outright. It must now diagnose the non-constant bound. */
     10 static int n;
     11 char buf[n ? 8 : 1];
     12 
     13 int test_main(void) { return 0; }