kit

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

commit 28e75424c3c6c828f561cb5a6f216235f1dd5ad7
parent 01aa94a3053b9d39aa5660b4b15b51ff228dc200
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Tue, 19 May 2026 08:01:07 -0700

test: add red C11 parser conformance cases

Diffstat:
Mtest/parse/CORPUS.md | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atest/parse/cases/6_4_4_4_01_wide_char_ucn.c | 3+++
Atest/parse/cases/6_4_4_4_01_wide_char_ucn.expected | 1+
Atest/parse/cases/6_4_4_4_02_wide_char_hex_escape.c | 3+++
Atest/parse/cases/6_4_4_4_02_wide_char_hex_escape.expected | 1+
Atest/parse/cases/6_4_5_03_wide_string_sizeof.c | 5+++++
Atest/parse/cases/6_4_5_03_wide_string_sizeof.expected | 1+
Atest/parse/cases/6_5_65_file_scope_compound_literal.c | 5+++++
Atest/parse/cases/6_5_65_file_scope_compound_literal.expected | 1+
Atest/parse/cases/6_7_6_15_multidim_vla_local.c | 7+++++++
Atest/parse/cases/6_7_6_15_multidim_vla_local.expected | 1+
Atest/parse/cases/6_9_14_old_style_definition.c | 10++++++++++
Atest/parse/cases/6_9_14_old_style_definition.expected | 1+
Atest/parse/cases_err/6_5_address_of_register.c | 4++++
Atest/parse/cases_err/6_5_void_pointer_arith.c | 5+++++
Atest/parse/cases_err/6_6_array_bound_float.c | 4++++
Atest/parse/cases_err/6_7_2_1_duplicate_member.c | 8++++++++
Atest/parse/cases_err/6_7_2_1_flex_array_not_last.c | 9+++++++++
Atest/parse/cases_err/6_7_2_1_flex_array_only_member.c | 7+++++++
Atest/parse/cases_err/6_7_2_1_member_extern.c | 7+++++++
Atest/parse/cases_err/6_7_2_1_member_inline.c | 7+++++++
Atest/parse/cases_err/6_7_2_1_member_noreturn.c | 7+++++++
Atest/parse/cases_err/6_7_2_1_member_static.c | 7+++++++
Atest/parse/cases_err/6_7_2_1_member_thread_local.c | 7+++++++
Atest/parse/cases_err/6_7_2_1_member_typedef.c | 7+++++++
Atest/parse/cases_err/6_7_2_4_atomic_array_type.c | 5+++++
Atest/parse/cases_err/6_7_2_4_atomic_atomic_type.c | 5+++++
Atest/parse/cases_err/6_7_2_4_atomic_qualified_type.c | 5+++++
Atest/parse/cases_err/6_7_2_void_object.c | 5+++++
Atest/parse/cases_err/6_7_3_restrict_object.c | 4++++
Atest/parse/cases_err/6_7_4_inline_object.c | 5+++++
Atest/parse/cases_err/6_7_4_noreturn_object.c | 5+++++
Atest/parse/cases_err/6_7_5_alignas_bitfield.c | 7+++++++
Atest/parse/cases_err/6_7_5_alignas_function.c | 7+++++++
Atest/parse/cases_err/6_7_5_alignas_non_power_of_two.c | 5+++++
Atest/parse/cases_err/6_7_5_alignas_typedef.c | 6++++++
Atest/parse/cases_err/6_7_5_alignas_weaker_than_natural.c | 5+++++
Atest/parse/cases_err/6_7_6_param_auto.c | 7+++++++
Atest/parse/cases_err/6_7_6_param_extern.c | 7+++++++
Atest/parse/cases_err/6_7_6_param_thread_local.c | 7+++++++
Atest/parse/cases_err/6_7_6_param_typedef.c | 7+++++++
Atest/parse/cases_err/6_7_6_static_param_scalar.c | 7+++++++
Atest/parse/cases_err/6_7_file_scope_auto.c | 5+++++
Atest/parse/cases_err/6_7_file_scope_register.c | 5+++++
Atest/parse/cases_err/6_7_storage_class_static_thread_local_function.c | 7+++++++
Atest/parse/cases_err/6_7_thread_local_block_auto.c | 4++++
Atest/parse/cases_err/6_7_thread_local_function.c | 7+++++++
Atest/parse/cases_err/6_7_thread_local_typedef.c | 6++++++
Atest/parse/cases_err/6_7_type_spec_bool_int.c | 5+++++
Atest/parse/cases_err/6_7_type_spec_char_int.c | 5+++++
Atest/parse/cases_err/6_7_type_spec_float_double.c | 5+++++
Atest/parse/cases_err/6_7_type_spec_long_float.c | 5+++++
Atest/parse/cases_err/6_7_type_spec_short_char.c | 5+++++
Atest/parse/cases_err/6_7_type_spec_signed_double.c | 5+++++
Atest/parse/cases_err/6_7_type_spec_too_many_longs.c | 5+++++
Atest/parse/cases_err/6_7_type_spec_unsigned_double.c | 5+++++
Atest/parse/cases_err/6_8_goto_into_vla_scope.c | 10++++++++++
Atest/parse/cases_err/6_8_switch_float.c | 7+++++++
58 files changed, 364 insertions(+), 0 deletions(-)

diff --git a/test/parse/CORPUS.md b/test/parse/CORPUS.md @@ -120,6 +120,14 @@ explicit cast; rows here fill in the rest of the conversion matrix. | `6_3_1_8_02_signed_wins` | ★ | `long a=40; unsigned int b=2; return (int)(a+b);` — signed `long` rank > `unsigned int` → result is `long` | 42 | | `6_3_2_3_03_null_void_cast` | ★ | `int *p = (void*)0; return p ? 99 : 42;` — `(void*)0` is null pointer constant | 42 | +## §6.4 Lexical Elements + +| Case | Status | Body | Expected | +|---|---|---|---| +| `6_4_4_4_01_wide_char_ucn` | RED | `L'\u00a3' == 163 ? 42 : 0` — universal character names in wide character constants | 42 | +| `6_4_4_4_02_wide_char_hex_escape` | RED | `L'\x012a' == 298 ? 42 : 0` — wide character constants must not be byte-truncated | 42 | +| `6_4_5_03_wide_string_sizeof` | RED | `sizeof(L"*") * 5 + 2` — wide string literal element type/width | 42 | + ## §6.5 Expressions Drives the entire expression grammar. One row per production where the @@ -185,6 +193,7 @@ here for completeness once they're real cases. | `6_5_56_compound_literal_struct` | ★ | `struct S s = (struct S){.a=20,.b=22}; return s.a+s.b;` — struct compound literal with designated init | 42 | | `6_5_57_unsigned_wrap_add` | ★ | `unsigned x=0xFFFFFFFFU; x+=1; return (int)(x & 0xff);` — unsigned addition wraps modulo 2^32 | 0 | | `6_5_58_large_integer_immediates` | ★ | 64-bit boundary integer literals including `INT64_MAX`, top-bit unsigned, and all-ones materialize correctly | 42 | +| `6_5_65_file_scope_compound_literal` | RED | `static int *p = (int[]){42}; return p[0];` — file-scope compound literal has static storage duration | 42 | ## §6.5.2.2 Aggregate function arguments @@ -350,6 +359,7 @@ already exercised in §6.5 and §6.7. | `6_7_6_12_vla_param` | ★ | `int sum_vla(int n, int a[n]){...}` — VLA dimension from earlier param; param adjusted to pointer | 42 | | `6_7_6_13_star_in_proto` | ★ | `int total(int n, int a[*]); int total(int n, int a[n]){...}` — `[*]` in non-definition prototype | 42 | | `6_7_6_14_func_param_adjust` | ★ | `int apply(int f(int), int x){return f(x);}` — function parameter adjusted to pointer-to-function | 42 | +| `6_7_6_15_multidim_vla_local` | RED | `int a[n][m]; a[n-1][m-1]=42; return a[5][6];` — multiple VLA dimensions in one declarator | 42 | ## §6.7.7 Type names @@ -470,6 +480,7 @@ memcpys into before `ret`. | `6_9_11_tentative_multi` | ★ | full TU: `int g; int g;` — two tentative defs merge; `return g+42` | 42 | | `6_9_12_tentative_incomplete_array` | ★ | full TU: `int arr[]; int arr[3];` — tentative + completing decl; `return arr[0]+arr[1]+arr[2]+42` | 42 | | `6_9_13_extern_func_def` | ★ | full TU: `extern int helper(int x){return x+1;}` — extern on a definition; `helper(41)` | 42 | +| `6_9_14_old_style_definition` | RED | K&R-style definition `static int add(a,b) int a; int b; { ... }` | 42 | ## Builtins @@ -540,6 +551,9 @@ cursor, so mixed and class-only sequences both need direct exercise. | `6_5_sizeof_bitfield` | RED | sizeof | `sizeof` cannot be applied to a bit-field; currently accepted | | `6_5_sizeof_function` | ★ | sizeof | `sizeof` cannot be applied to a function designator | | `6_5_type_mismatch` | · | implicit conversion | assigning `int*` to `int` | +| `6_5_address_of_register` | RED | register storage | taking the address of a register object must be rejected; currently accepted | +| `6_5_void_pointer_arith` | RED | pointer arithmetic | arithmetic on `void *` is not C11; currently accepted | +| `6_6_array_bound_float` | RED | integer constant expr | floating array bound must be rejected; currently accepted | | `6_6_static_init_nonconstant` | ★ | static initializer | file-scope static initializer from non-constant object | | `6_7_redefinition` | · | linkage / scope | two `int x = …` at file scope | | `6_8_break_outside_loop` | · | break/continue scope | `break;` outside iteration | @@ -556,10 +570,50 @@ cursor, so mixed and class-only sequences both need direct exercise. | `6_7_2_1_bitfield_nonconstant_width` | ★ | bitfield | bit-field width that is not an integer constant expression | | `6_7_2_two_struct_defs` | · | tag | two `struct S { ... };` definitions in same scope | | `6_7_2_1_bitfield_too_wide` | · | bitfield | `unsigned a:33;` exceeds underlying type | +| `6_7_2_1_duplicate_member` | RED | struct member | duplicate member name in one struct; currently accepted | +| `6_7_2_1_flex_array_not_last` | RED | flexible array | flexible array member not last; currently accepted | +| `6_7_2_1_flex_array_only_member` | RED | flexible array | flexible array member in otherwise empty struct; currently accepted | +| `6_7_2_1_member_static` | RED | struct member specs | storage-class specifier in struct member declaration; currently accepted | +| `6_7_2_1_member_extern` | RED | struct member specs | storage-class specifier in struct member declaration; currently accepted | +| `6_7_2_1_member_typedef` | RED | struct member specs | `typedef` in struct member declaration; currently accepted | +| `6_7_2_1_member_thread_local` | RED | struct member specs | `_Thread_local` in struct member declaration; currently accepted | +| `6_7_2_1_member_inline` | RED | struct member specs | `inline` in struct member declaration; currently accepted | +| `6_7_2_1_member_noreturn` | RED | struct member specs | `_Noreturn` in struct member declaration; currently accepted | +| `6_7_2_4_atomic_qualified_type` | RED | `_Atomic` type specifier | `_Atomic(const int)` violates C11 constraints; currently accepted | +| `6_7_2_4_atomic_array_type` | RED | `_Atomic` type specifier | `_Atomic(int[2])` violates C11 constraints; currently accepted | +| `6_7_2_4_atomic_atomic_type` | RED | `_Atomic` type specifier | nested atomic type violates C11 constraints; currently accepted | +| `6_7_2_void_object` | RED | object type | object declared with type `void`; currently accepted | | `6_7_3_const_assign` | · | const violation | `const int x = 0; x = 1;` | +| `6_7_3_restrict_object` | RED | qualifier constraints | `restrict` used on a non-pointer object; currently accepted | +| `6_7_4_inline_object` | RED | function specifier | `inline` used on an object declaration; currently accepted | +| `6_7_4_noreturn_object` | RED | function specifier | `_Noreturn` used on an object declaration; currently accepted | +| `6_7_5_alignas_weaker_than_natural` | RED | alignment specifier | nonzero `_Alignas` weaker than natural alignment; currently accepted | +| `6_7_5_alignas_non_power_of_two` | RED | alignment specifier | invalid `_Alignas(3)`; currently accepted | +| `6_7_5_alignas_bitfield` | RED | alignment specifier | `_Alignas` applied to a bit-field; currently accepted | +| `6_7_5_alignas_typedef` | RED | alignment specifier | `_Alignas` applied to a typedef declaration; currently accepted | +| `6_7_5_alignas_function` | RED | alignment specifier | `_Alignas` applied to a function definition; currently accepted | +| `6_7_6_param_auto` | RED | parameter declaration | non-`register` storage-class specifier on parameter; currently accepted | +| `6_7_6_param_extern` | RED | parameter declaration | non-`register` storage-class specifier on parameter; currently accepted | +| `6_7_6_param_typedef` | RED | parameter declaration | `typedef` storage-class specifier on parameter; currently accepted | +| `6_7_6_param_thread_local` | RED | parameter declaration | `_Thread_local` storage-class specifier on parameter; currently accepted | +| `6_7_6_static_param_scalar` | RED | parameter declaration | `static` on scalar parameter; currently accepted | | `6_7_6_function_returning_array` | ★ | function declarator | function returning array | | `6_7_6_function_returning_function` | ★ | function declarator | function returning function | | `6_7_6_variadic_not_last` | ★ | function declarator | variadic marker not in final position | +| `6_7_file_scope_auto` | RED | storage class | `auto` at file scope; currently accepted | +| `6_7_file_scope_register` | RED | storage class | `register` at file scope; currently accepted | +| `6_7_storage_class_static_thread_local_function` | RED | storage class | `_Thread_local` on a function definition; currently accepted | +| `6_7_thread_local_block_auto` | RED | storage class | block-scope `_Thread_local` without `static`/`extern`; currently accepted | +| `6_7_thread_local_function` | RED | storage class | `_Thread_local` on a function definition; currently accepted | +| `6_7_thread_local_typedef` | RED | storage class | `_Thread_local` in a typedef declaration; currently accepted | +| `6_7_type_spec_bool_int` | RED | declaration specifiers | invalid `_Bool int` specifier combination; currently accepted | +| `6_7_type_spec_char_int` | RED | declaration specifiers | invalid `char int` specifier combination; currently accepted | +| `6_7_type_spec_float_double` | RED | declaration specifiers | invalid `float double` specifier combination; currently accepted | +| `6_7_type_spec_long_float` | RED | declaration specifiers | invalid `long float` specifier combination; currently accepted | +| `6_7_type_spec_short_char` | RED | declaration specifiers | invalid `short char` specifier combination; currently accepted | +| `6_7_type_spec_signed_double` | RED | declaration specifiers | invalid `signed double` specifier combination; currently accepted | +| `6_7_type_spec_too_many_longs` | RED | declaration specifiers | invalid `long long long` specifier combination; currently accepted | +| `6_7_type_spec_unsigned_double` | RED | declaration specifiers | invalid `unsigned double` specifier combination; currently accepted | | `6_7_9_excess_scalar_init` | ★ | initializer | too many initializers for scalar object | | `6_7_9_invalid_array_designator` | ★ | initializer | array designator index that is not an integer constant expression | | `6_7_9_invalid_struct_designator` | ★ | initializer | designator names no member of the target struct | @@ -571,6 +625,8 @@ cursor, so mixed and class-only sequences both need direct exercise. | `6_8_duplicate_case` | · | switch | two `case 1:` in same switch | | `6_8_duplicate_default` | · | switch | two `default:` labels in same switch | | `6_8_goto_undefined_label` | · | goto | `goto missing;` with no matching label | +| `6_8_goto_into_vla_scope` | RED | goto | `goto` into scope of a variably modified object; currently accepted | +| `6_8_switch_float` | RED | switch | floating controlling expression in `switch`; currently accepted | | `6_8_duplicate_label` | · | label | two `L:` in the same function | | `6_9_void_param_with_other` | · | function declarator | `int f(void, int);` | diff --git a/test/parse/cases/6_4_4_4_01_wide_char_ucn.c b/test/parse/cases/6_4_4_4_01_wide_char_ucn.c @@ -0,0 +1,3 @@ +int test_main(void) { + return L'\u00a3' == 163 ? 42 : 0; +} diff --git a/test/parse/cases/6_4_4_4_01_wide_char_ucn.expected b/test/parse/cases/6_4_4_4_01_wide_char_ucn.expected @@ -0,0 +1 @@ +42 diff --git a/test/parse/cases/6_4_4_4_02_wide_char_hex_escape.c b/test/parse/cases/6_4_4_4_02_wide_char_hex_escape.c @@ -0,0 +1,3 @@ +int test_main(void) { + return L'\x012a' == 298 ? 42 : 0; +} diff --git a/test/parse/cases/6_4_4_4_02_wide_char_hex_escape.expected b/test/parse/cases/6_4_4_4_02_wide_char_hex_escape.expected @@ -0,0 +1 @@ +42 diff --git a/test/parse/cases/6_4_5_03_wide_string_sizeof.c b/test/parse/cases/6_4_5_03_wide_string_sizeof.c @@ -0,0 +1,5 @@ +#include <stddef.h> + +int test_main(void) { + return (int)sizeof(L"*") * 5 + 2; +} diff --git a/test/parse/cases/6_4_5_03_wide_string_sizeof.expected b/test/parse/cases/6_4_5_03_wide_string_sizeof.expected @@ -0,0 +1 @@ +42 diff --git a/test/parse/cases/6_5_65_file_scope_compound_literal.c b/test/parse/cases/6_5_65_file_scope_compound_literal.c @@ -0,0 +1,5 @@ +static int *p = (int[]){42}; + +int test_main(void) { + return p[0]; +} diff --git a/test/parse/cases/6_5_65_file_scope_compound_literal.expected b/test/parse/cases/6_5_65_file_scope_compound_literal.expected @@ -0,0 +1 @@ +42 diff --git a/test/parse/cases/6_7_6_15_multidim_vla_local.c b/test/parse/cases/6_7_6_15_multidim_vla_local.c @@ -0,0 +1,7 @@ +int test_main(void) { + int n = 6; + int m = 7; + int a[n][m]; + a[n - 1][m - 1] = 42; + return a[5][6]; +} diff --git a/test/parse/cases/6_7_6_15_multidim_vla_local.expected b/test/parse/cases/6_7_6_15_multidim_vla_local.expected @@ -0,0 +1 @@ +42 diff --git a/test/parse/cases/6_9_14_old_style_definition.c b/test/parse/cases/6_9_14_old_style_definition.c @@ -0,0 +1,10 @@ +static int add(a, b) +int a; +int b; +{ + return a + b; +} + +int test_main(void) { + return add(20, 22); +} diff --git a/test/parse/cases/6_9_14_old_style_definition.expected b/test/parse/cases/6_9_14_old_style_definition.expected @@ -0,0 +1 @@ +42 diff --git a/test/parse/cases_err/6_5_address_of_register.c b/test/parse/cases_err/6_5_address_of_register.c @@ -0,0 +1,4 @@ +int test_main(void) { + register int x = 0; + return &x != 0; +} diff --git a/test/parse/cases_err/6_5_void_pointer_arith.c b/test/parse/cases_err/6_5_void_pointer_arith.c @@ -0,0 +1,5 @@ +int test_main(void) { + void *p = 0; + p = p + 1; + return p != 0; +} diff --git a/test/parse/cases_err/6_6_array_bound_float.c b/test/parse/cases_err/6_6_array_bound_float.c @@ -0,0 +1,4 @@ +int test_main(void) { + int a[1.0]; + return (int)(sizeof(a) / sizeof(a[0])); +} diff --git a/test/parse/cases_err/6_7_2_1_duplicate_member.c b/test/parse/cases_err/6_7_2_1_duplicate_member.c @@ -0,0 +1,8 @@ +struct S { + int x; + int x; +}; + +int test_main(void) { + return 0; +} diff --git a/test/parse/cases_err/6_7_2_1_flex_array_not_last.c b/test/parse/cases_err/6_7_2_1_flex_array_not_last.c @@ -0,0 +1,9 @@ +struct S { + int len; + char data[]; + int trailer; +}; + +int test_main(void) { + return 0; +} diff --git a/test/parse/cases_err/6_7_2_1_flex_array_only_member.c b/test/parse/cases_err/6_7_2_1_flex_array_only_member.c @@ -0,0 +1,7 @@ +struct S { + char data[]; +}; + +int test_main(void) { + return 0; +} diff --git a/test/parse/cases_err/6_7_2_1_member_extern.c b/test/parse/cases_err/6_7_2_1_member_extern.c @@ -0,0 +1,7 @@ +struct S { + extern int x; +}; + +int test_main(void) { + return 0; +} diff --git a/test/parse/cases_err/6_7_2_1_member_inline.c b/test/parse/cases_err/6_7_2_1_member_inline.c @@ -0,0 +1,7 @@ +struct S { + inline int x; +}; + +int test_main(void) { + return 0; +} diff --git a/test/parse/cases_err/6_7_2_1_member_noreturn.c b/test/parse/cases_err/6_7_2_1_member_noreturn.c @@ -0,0 +1,7 @@ +struct S { + _Noreturn int x; +}; + +int test_main(void) { + return 0; +} diff --git a/test/parse/cases_err/6_7_2_1_member_static.c b/test/parse/cases_err/6_7_2_1_member_static.c @@ -0,0 +1,7 @@ +struct S { + static int x; +}; + +int test_main(void) { + return 0; +} diff --git a/test/parse/cases_err/6_7_2_1_member_thread_local.c b/test/parse/cases_err/6_7_2_1_member_thread_local.c @@ -0,0 +1,7 @@ +struct S { + _Thread_local int x; +}; + +int test_main(void) { + return 0; +} diff --git a/test/parse/cases_err/6_7_2_1_member_typedef.c b/test/parse/cases_err/6_7_2_1_member_typedef.c @@ -0,0 +1,7 @@ +struct S { + typedef int I; +}; + +int test_main(void) { + return 0; +} diff --git a/test/parse/cases_err/6_7_2_4_atomic_array_type.c b/test/parse/cases_err/6_7_2_4_atomic_array_type.c @@ -0,0 +1,5 @@ +_Atomic(int[2]) x; + +int test_main(void) { + return x[0]; +} diff --git a/test/parse/cases_err/6_7_2_4_atomic_atomic_type.c b/test/parse/cases_err/6_7_2_4_atomic_atomic_type.c @@ -0,0 +1,5 @@ +_Atomic(_Atomic int) x; + +int test_main(void) { + return x; +} diff --git a/test/parse/cases_err/6_7_2_4_atomic_qualified_type.c b/test/parse/cases_err/6_7_2_4_atomic_qualified_type.c @@ -0,0 +1,5 @@ +_Atomic(const int) x; + +int test_main(void) { + return x; +} diff --git a/test/parse/cases_err/6_7_2_void_object.c b/test/parse/cases_err/6_7_2_void_object.c @@ -0,0 +1,5 @@ +void x; + +int test_main(void) { + return 0; +} diff --git a/test/parse/cases_err/6_7_3_restrict_object.c b/test/parse/cases_err/6_7_3_restrict_object.c @@ -0,0 +1,4 @@ +int test_main(void) { + restrict int x = 0; + return x; +} diff --git a/test/parse/cases_err/6_7_4_inline_object.c b/test/parse/cases_err/6_7_4_inline_object.c @@ -0,0 +1,5 @@ +inline int x; + +int test_main(void) { + return x; +} diff --git a/test/parse/cases_err/6_7_4_noreturn_object.c b/test/parse/cases_err/6_7_4_noreturn_object.c @@ -0,0 +1,5 @@ +_Noreturn int x; + +int test_main(void) { + return x; +} diff --git a/test/parse/cases_err/6_7_5_alignas_bitfield.c b/test/parse/cases_err/6_7_5_alignas_bitfield.c @@ -0,0 +1,7 @@ +struct S { + _Alignas(8) int x: 3; +}; + +int test_main(void) { + return 0; +} diff --git a/test/parse/cases_err/6_7_5_alignas_function.c b/test/parse/cases_err/6_7_5_alignas_function.c @@ -0,0 +1,7 @@ +_Alignas(16) int f(void) { + return 0; +} + +int test_main(void) { + return f(); +} diff --git a/test/parse/cases_err/6_7_5_alignas_non_power_of_two.c b/test/parse/cases_err/6_7_5_alignas_non_power_of_two.c @@ -0,0 +1,5 @@ +_Alignas(3) static int x; + +int test_main(void) { + return x; +} diff --git a/test/parse/cases_err/6_7_5_alignas_typedef.c b/test/parse/cases_err/6_7_5_alignas_typedef.c @@ -0,0 +1,6 @@ +_Alignas(16) typedef int I; + +int test_main(void) { + I x = 0; + return x; +} diff --git a/test/parse/cases_err/6_7_5_alignas_weaker_than_natural.c b/test/parse/cases_err/6_7_5_alignas_weaker_than_natural.c @@ -0,0 +1,5 @@ +_Alignas(1) static double x; + +int test_main(void) { + return (int)sizeof x; +} diff --git a/test/parse/cases_err/6_7_6_param_auto.c b/test/parse/cases_err/6_7_6_param_auto.c @@ -0,0 +1,7 @@ +static int f(auto int x) { + return x; +} + +int test_main(void) { + return f(0); +} diff --git a/test/parse/cases_err/6_7_6_param_extern.c b/test/parse/cases_err/6_7_6_param_extern.c @@ -0,0 +1,7 @@ +static int f(extern int x) { + return x; +} + +int test_main(void) { + return f(0); +} diff --git a/test/parse/cases_err/6_7_6_param_thread_local.c b/test/parse/cases_err/6_7_6_param_thread_local.c @@ -0,0 +1,7 @@ +static int f(_Thread_local int x) { + return x; +} + +int test_main(void) { + return f(0); +} diff --git a/test/parse/cases_err/6_7_6_param_typedef.c b/test/parse/cases_err/6_7_6_param_typedef.c @@ -0,0 +1,7 @@ +static int f(typedef int x) { + return x; +} + +int test_main(void) { + return f(0); +} diff --git a/test/parse/cases_err/6_7_6_static_param_scalar.c b/test/parse/cases_err/6_7_6_static_param_scalar.c @@ -0,0 +1,7 @@ +static int f(static int x) { + return x; +} + +int test_main(void) { + return f(0); +} diff --git a/test/parse/cases_err/6_7_file_scope_auto.c b/test/parse/cases_err/6_7_file_scope_auto.c @@ -0,0 +1,5 @@ +auto int x; + +int test_main(void) { + return x; +} diff --git a/test/parse/cases_err/6_7_file_scope_register.c b/test/parse/cases_err/6_7_file_scope_register.c @@ -0,0 +1,5 @@ +register int x; + +int test_main(void) { + return x; +} diff --git a/test/parse/cases_err/6_7_storage_class_static_thread_local_function.c b/test/parse/cases_err/6_7_storage_class_static_thread_local_function.c @@ -0,0 +1,7 @@ +static _Thread_local int f(void) { + return 0; +} + +int test_main(void) { + return f(); +} diff --git a/test/parse/cases_err/6_7_thread_local_block_auto.c b/test/parse/cases_err/6_7_thread_local_block_auto.c @@ -0,0 +1,4 @@ +int test_main(void) { + _Thread_local int x = 42; + return x; +} diff --git a/test/parse/cases_err/6_7_thread_local_function.c b/test/parse/cases_err/6_7_thread_local_function.c @@ -0,0 +1,7 @@ +_Thread_local int f(void) { + return 0; +} + +int test_main(void) { + return f(); +} diff --git a/test/parse/cases_err/6_7_thread_local_typedef.c b/test/parse/cases_err/6_7_thread_local_typedef.c @@ -0,0 +1,6 @@ +typedef _Thread_local int I; + +int test_main(void) { + I x = 0; + return x; +} diff --git a/test/parse/cases_err/6_7_type_spec_bool_int.c b/test/parse/cases_err/6_7_type_spec_bool_int.c @@ -0,0 +1,5 @@ +_Bool int x; + +int test_main(void) { + return x; +} diff --git a/test/parse/cases_err/6_7_type_spec_char_int.c b/test/parse/cases_err/6_7_type_spec_char_int.c @@ -0,0 +1,5 @@ +char int x; + +int test_main(void) { + return x; +} diff --git a/test/parse/cases_err/6_7_type_spec_float_double.c b/test/parse/cases_err/6_7_type_spec_float_double.c @@ -0,0 +1,5 @@ +float double x; + +int test_main(void) { + return (int)x; +} diff --git a/test/parse/cases_err/6_7_type_spec_long_float.c b/test/parse/cases_err/6_7_type_spec_long_float.c @@ -0,0 +1,5 @@ +long float x; + +int test_main(void) { + return (int)x; +} diff --git a/test/parse/cases_err/6_7_type_spec_short_char.c b/test/parse/cases_err/6_7_type_spec_short_char.c @@ -0,0 +1,5 @@ +short char x; + +int test_main(void) { + return x; +} diff --git a/test/parse/cases_err/6_7_type_spec_signed_double.c b/test/parse/cases_err/6_7_type_spec_signed_double.c @@ -0,0 +1,5 @@ +signed double x; + +int test_main(void) { + return (int)x; +} diff --git a/test/parse/cases_err/6_7_type_spec_too_many_longs.c b/test/parse/cases_err/6_7_type_spec_too_many_longs.c @@ -0,0 +1,5 @@ +long long long x; + +int test_main(void) { + return (int)x; +} diff --git a/test/parse/cases_err/6_7_type_spec_unsigned_double.c b/test/parse/cases_err/6_7_type_spec_unsigned_double.c @@ -0,0 +1,5 @@ +unsigned double x; + +int test_main(void) { + return (int)x; +} diff --git a/test/parse/cases_err/6_8_goto_into_vla_scope.c b/test/parse/cases_err/6_8_goto_into_vla_scope.c @@ -0,0 +1,10 @@ +int test_main(void) { + int n = 4; + goto inside; + { + int a[n]; +inside: + a[0] = 0; + } + return 0; +} diff --git a/test/parse/cases_err/6_8_switch_float.c b/test/parse/cases_err/6_8_switch_float.c @@ -0,0 +1,7 @@ +int test_main(void) { + switch (1.0) { + case 1: + return 0; + } + return 0; +}