Unified · Split
| @@ -5442,7 +5442,8 @@ static int post_type(CType *type, AttributeDef *ad, int storage, int td) · 5441 unmodified lines | |||
| 5442 | } | 5442 | } |
| 5443 | if (tok != ']') { | 5443 | if (tok != ']') { |
| 5444 | nocode_wanted = 1; | 5444 | nocode_wanted = 1; |
| 5445 | gexpr(), vpop(); | 5445 | gexpr(); |
| 5446 | goto check; | ||
| 5446 | } | 5447 | } |
| 5447 | break; | 5448 | break; |
| 5448 | 5449 | ||
| @@ -5457,6 +5458,7 @@ static int post_type(CType *type, AttributeDef *ad, int storage, int td) · 8 unmodified lines | |||
| 5457 | nocode_wanted = 0; | 5458 | nocode_wanted = 0; |
| 5458 | gexpr(); | 5459 | gexpr(); |
| 5459 | } | 5460 | } |
| 5461 | check: | ||
| 5460 | if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) { | 5462 | if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) { |
| 5461 | n = vtop->c.i; | 5463 | n = vtop->c.i; |
| 5462 | if (n < 0) | 5464 | if (n < 0) |
| @@ -2997,10 +2997,45 @@ void c99_vla_test_2(int d, int h, int w) · 2996 unmodified lines | |||
| 2997 | free (arr); | 2997 | free (arr); |
| 2998 | } | 2998 | } |
| 2999 | 2999 | ||
| 3000 | void c99_vla_test_3a (int arr[2][3][4]) | ||
| 3001 | { | ||
| 3002 | printf ("%d\n", arr[1][2][3]); | ||
| 3003 | } | ||
| 3004 | |||
| 3005 | void c99_vla_test_3b(int s, int arr[s][3][4]) | ||
| 3006 | { | ||
| 3007 | printf ("%d\n", arr[1][2][3]); | ||
| 3008 | } | ||
| 3009 | |||
| 3010 | void c99_vla_test_3c(int s, int arr[2][s][4]) | ||
| 3011 | { | ||
| 3012 | printf ("%d\n", arr[1][2][3]); | ||
| 3013 | } | ||
| 3014 | |||
| 3015 | void c99_vla_test_3d(int s, int arr[2][3][s]) | ||
| 3016 | { | ||
| 3017 | printf ("%d\n", arr[1][2][3]); | ||
| 3018 | } | ||
| 3019 | |||
| 3020 | void c99_vla_test_3(void) | ||
| 3021 | { | ||
| 3022 | int a[2][3][4]; | ||
| 3023 | |||
| 3024 | memset (a, 0, sizeof(a)); | ||
| 3025 | a[1][2][3] = 2; | ||
| 3026 | c99_vla_test_3a(a); | ||
| 3027 | c99_vla_test_3b(2, a); | ||
| 3028 | #if 0 // FIXME | ||
| 3029 | c99_vla_test_3c(3, a); | ||
| 3030 | c99_vla_test_3d(4, a); | ||
| 3031 | #endif | ||
| 3032 | } | ||
| 3033 | |||
| 3000 | void c99_vla_test(void) | 3034 | void c99_vla_test(void) |
| 3001 | { | 3035 | { |
| 3002 | c99_vla_test_1(5, 2); | 3036 | c99_vla_test_1(5, 2); |
| 3003 | c99_vla_test_2(3, 4, 5); | 3037 | c99_vla_test_2(3, 4, 5); |
| 3038 | c99_vla_test_3(); | ||
| 3004 | } | 3039 | } |
| 3005 | 3040 | ||
| 3006 | 3041 | ||