Unnamed: 0
int64
0
0
repo_id
stringlengths
5
186
file_path
stringlengths
15
223
content
stringlengths
1
32.8M
0
repos/arocc/test
repos/arocc/test/cases/unary expressions.c
void foo(void) { (void)+1; +(int*)1; (void)-1.0; -(int*)1; int a, *b; ++a; --b; a--; b++; 1++; --1; const int c; ++c; c--; (void)~1; ~2.0; ~(void)1; (void)!a; (void)!b; (void)!(void)1; (void); register int d; &d; _Complex double e; (void) __imag__ e; (void) __real a; (void) __real__ b; struct S { int x: 4; } s; (void)&(s.x); } #define EXPECTED_ERRORS "unary expressions.c:3:5: error: invalid argument type 'int *' to unary expression" \ "unary expressions.c:5:5: error: invalid argument type 'int *' to unary expression" \ "unary expressions.c:11:6: error: expression is not assignable" \ "unary expressions.c:12:5: error: expression is not assignable" \ "unary expressions.c:14:5: error: expression is not assignable" \ "unary expressions.c:15:6: error: expression is not assignable" \ "unary expressions.c:17:5: error: invalid argument type 'double' to unary expression" \ "unary expressions.c:18:5: error: invalid argument type 'void' to unary expression" \ "unary expressions.c:21:11: error: invalid argument type 'void' to unary expression" \ "unary expressions.c:22:11: error: expected expression" \ "unary expressions.c:24:5: error: address of register variable requested" \ "unary expressions.c:28:12: error: invalid type 'int *' to __real operator" \ "unary expressions.c:32:11: error: address of bit-field requested" \
0
repos/arocc/test
repos/arocc/test/cases/pragma during parsing.c
void foo(void) { #pragma GCC diagnostic error "-Wint-conversion" int *x = 5; #pragma GCC diagnostic ignored "-Wint-conversion" } #define EXPECTED_ERRORS "pragma during parsing.c:3:14: error: implicit integer to pointer conversion from 'int' to 'int *' [-Werror,-Wint-conversion]"
0
repos/arocc/test
repos/arocc/test/cases/array argument too small.c
void foo(int x[static 10]) { } void bar(void) { int x[5]; foo(x); } #define EXPECTED_ERRORS "array argument too small.c:7:9: warning: array argument is too small; contains 5 elements, callee requires at least 10 [-Warray-bounds]"\ "array argument too small.c:1:14: note: callee declares array parameter as static here"
0
repos/arocc/test
repos/arocc/test/cases/nested unterminated macro.c
//aro-args -E -P #define str(s) # s #define xstr(s) str(s) #define INCFILE(n) str(strcmp( xstr(INCFILE(2)) INCFILE(2)) #define EXPECTED_ERRORS \ "nested unterminated macro.c:5:6: error: unterminated function macro argument list" \ "nested unterminated macro.c:4:20: note: expanded from here" \ "nested unterminated macro.c:5:18: error: unterminated function macro argument list" \ "nested unterminated macro.c:4:20: note: expanded from here" \
0
repos/arocc/test
repos/arocc/test/cases/vectors.c
typedef float *invalid1 __attribute__((vector_size(8))); typedef float invalid2 __attribute__((vector_size(9))); typedef float f2v __attribute__((vector_size(8))); void foo(void) { f2v a, b; a = b; a *= 2; (f2v)1; } #define EXPECTED_ERRORS "vectors.c:1:40: error: invalid vector element type 'float *'" \ "vectors.c:2:39: error: vector size not an integral multiple of component size" \ "vectors.c:9:5: error: cannot cast to non arithmetic or pointer type '__attribute__((__vector_size__(2 * sizeof(float)))) float (vector of 2 'float' values)'" \
0
repos/arocc/test
repos/arocc/test/cases/attributes.c
enum E { unavailable __attribute__((unavailable)) = 0, oldval __attribute__((deprecated)), newval }; void foo(void) { int a __attribute__((noreturn)); int b __attribute__((does_not_exist(4))); int c __attribute__((aligned(16))); int d __attribute__((aligned(4 + 4 + 4 + 4))); int e __attribute__((aligned(4))); int __attribute__((aligned(4))) f; __attribute__((aligned(4))) int g; __attribute__(()) int h; __attribute__((aligned(4), unused)) int i; __attribute__((aligned(4), unused, uninitialized)) int j; __attribute__((mode(__byte__))) int k; __attribute__((section("mysegment,mysection"))) static int l; } int bar(void) { Label: __attribute__((deprecated)); return 0; ErrorHandling: __attribute__((__hot__, cold(), __unused__())); return 1; } void bad_fallthrough(void) { __attribute__((fallthrough)); } void invalid_statement_attribute(void) { __attribute__((noreturn)); } void qux(int x) { switch (x) { case 1: bar(); __attribute__((fallthrough)); case 2: __attribute__((fallthrough)); default: return; } } __attribute__((format(printf, 2, 3))) __attribute__((noreturn)) void my_printf (void *my_object, const char *my_format, ...); __attribute__((noreturn, format(printf, 2, 3), hot)) void my_printf1 (void *my_object, const char *my_format, ...); __attribute__((format(printf, 2, 3))) void my_printf2 (void *my_object, const char *my_format, ...); __attribute__((format(printf, 2, 3), noreturn)) void my_printf3 (void *my_object, const char *my_format, ...); struct S1 { int x; } __attribute__ ((aligned (8))); struct __attribute__ ((aligned (8))) S2 { int x; }; union U1 { int x; int y; } __attribute__ ((aligned (8))); union __attribute__ ((aligned (8))) U2 { int x; int y; }; enum E1 { FOO } __attribute__ ((aligned (8))); enum __attribute__ ((aligned (8))) E2 { BAR }; void vectors(void) { __attribute__ ((vector_size (32))) typedef __attribute__ ((aligned (32))) int int_vec32_t0; typedef __attribute__ ((vector_size (32))) int int_vec32_t1; typedef int __attribute__ ((vector_size (32))) int_vec32_t2; typedef int int_vec32_t3 __attribute__ ((vector_size (32))); } void diagnostics(void) { int __attribute__((aligned(4))) x; x(0); } void math(void) { int __attribute__((aligned(4))) x = 0; (void) (x / 2); } extern int abs (int __x) __attribute__((__noreturn__ )) __attribute__((__const__)); typedef int X(); X x __attribute__((cold)); typedef struct { __attribute__((__aligned__(__alignof__(long long)))) long long __clang_max_align_nonce1, __attribute__((packed)) nonce2, nonce3; long double __clang_max_align_nonce2 __attribute__((__aligned__(__alignof__(long double)))); } max_align_t; __attribute__((unused)) void attributed_old_style_func(baz) int baz; { } _Static_assert(sizeof(struct S2) == 8, "sizeof aligned struct"); _Static_assert(_Alignof(union U1) == 8, "_Alignof aligned union"); typedef struct { short i:1 __attribute__((aligned(8))); } A; __attribute__((aligned(32))) char aligned_arr[] = {1, 2, 3}; _Static_assert(sizeof(aligned_arr) == 3, ""); __attribute__((section(1))) int Z; __attribute__(()) // test attribute at eof #define TESTS_SKIPPED 1 #define EXPECTED_ERRORS \ "attributes.c:8:26: warning: attribute 'noreturn' ignored on variables [-Wignored-attributes]" \ "attributes.c:9:26: warning: unknown attribute 'does_not_exist' ignored [-Wunknown-attributes]" \ "attributes.c:27:20: warning: attribute 'deprecated' ignored on labels [-Wignored-attributes]" \ "attributes.c:31:29: warning: ignoring attribute 'cold' because it conflicts with attribute 'hot' [-Wignored-attributes]" \ "attributes.c:36:5: error: fallthrough annotation does not directly precede switch label" \ "attributes.c:40:20: error: 'noreturn' attribute cannot be applied to a statement" \ "attributes.c:76:6: error: cannot call non function type 'int'" \ "attributes.c:110:24: error: Attribute argument is invalid, expected a string but got an integer constant" \ "attributes.c:112:18: error: expected identifier or '('" \
0
repos/arocc/test
repos/arocc/test/cases/tentative definitions.c
struct Tentative; struct Tentative t1, t2; void foo(void) { struct Tentative { // does not complete tentative definition in outer scope int x; }; struct S1 s1; // tentative definition not allowed in function struct S1 { int a,b,c,d; }; } enum E e; union __attribute__((aligned(32))) U; union __attribute__((aligned(64))) U u; struct S1 s1; struct S2; struct S2 s2; struct S1 { int x; }; struct S2 { int x; int y; }; _Static_assert(sizeof(s1) == sizeof(struct S1), ""); _Static_assert(sizeof(s2) == sizeof(struct S2), ""); struct A { struct B b; }; struct B { int x; }; extern struct Tentative tentative_extern; #define EXPECTED_ERRORS "tentative definitions.c:9:15: error: variable has incomplete type 'struct S1'" \ "tentative definitions.c:37:14: error: field has incomplete type 'struct B'" \ "tentative definitions.c:2:18: error: tentative definition has type 'struct Tentative' that is never completed" \ "tentative definitions.c:1:8: note: forward declaration of 'struct Tentative'" \ "tentative definitions.c:15:8: error: tentative definition has type 'enum E' that is never completed" \ "tentative definitions.c:15:6: note: forward declaration of 'enum E'" \ "tentative definitions.c:18:38: error: tentative definition has type 'union U' that is never completed" \ "tentative definitions.c:17:36: note: forward declaration of 'union U'" \
0
repos/arocc/test
repos/arocc/test/cases/compound literals.c
//aro-args -std=c23 struct A { int x; }; struct B { struct A a; int y; }; int *p = (int []){2, 4}; void foo(struct A *a) { (void)a; } void bar(void) { int a = (struct B){ .y = 1, .a = {.x = 2}, }.a.x; int b = (int []){1,2,3,4,5}[4]; int c = (int []){1,2,3,4,5}[10]; foo(&(struct A){.x = 42}); char *str1 = "string 1"; char *str2 = (char []){"string 2"}; const char *str3 = (const char []){"string 3"}; } void baz() { &(register int){0}; &(static thread_local int){0}; &(extern int){0}; } #define EXPECTED_ERRORS \ "compound literals.c:21:32: warning: array index 10 is past the end of the array [-Warray-bounds]" \ "compound literals.c:30:5: error: address of register variable requested" \ "compound literals.c:31:5: warning: expression result unused [-Wunused-value]" \ "compound literals.c:32:7: error: compound literal cannot have extern storage class" \
0
repos/arocc/test
repos/arocc/test/cases/c23 defines.c
//aro-args -std=c23 _Static_assert(__STDC_VERSION__ == 202311L, "");
0
repos/arocc/test
repos/arocc/test/cases/standard-placeholder-example.c
//aro-args -E -P // example from the C18 standard draft, 6.10.3.5, example 5 #define t(x,y,z) x ## y ## z int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,), t(10,,), t(,11,), t(,,12), t(,,) };
0
repos/arocc/test
repos/arocc/test/cases/gnuc version default.c
_Static_assert(__GNUC__ == 4, ""); _Static_assert(__GNUC_MINOR__ == 2, ""); _Static_assert(__GNUC_PATCHLEVEL__ == 1, "");
0
repos/arocc/test
repos/arocc/test/cases/macro expansion to defined parsed.c
//aro-args -Wexpansion-to-defined #define DEFINED defined void foo(void) { int DEFINED = 0; defined = 1; }
0
repos/arocc/test
repos/arocc/test/cases/indirect macro invocation wrong arg count.c
#define NO_ERROR_VALIDATION #define h(x) x(0) #define s() h(s)
0
repos/arocc/test
repos/arocc/test/cases/repeated preprocessor tokens.c
#define NO_ERROR_VALIDATION #define h(x)0(x(0)0 #define s() #define K h( #define H h #define L H #define SS K H()L(s)H SS)
0
repos/arocc/test
repos/arocc/test/cases/unreachable code.c
int test(int a){ switch(a) { default: break; } return 1; } int test1(int a){ switch(a) { break; a=1; } return 1; } int test2(int a){ switch(a) { return 1; a=1; } return 1; } int compound_stmt(int a){ { a=1; return 1; a=2; } } int if_then_else(int a){ if(a) return 1; else return 2; return 3; } #define EXPECTED_ERRORS "unreachable code.c:10:3: warning: unreachable code [-Wunreachable-code]" \ "unreachable code.c:17:3: warning: unreachable code [-Wunreachable-code]" \ "unreachable code.c:25:3: warning: unreachable code [-Wunreachable-code]" \ "unreachable code.c:33:2: warning: unreachable code [-Wunreachable-code]"
0
repos/arocc/test
repos/arocc/test/cases/limits header.c
//aro-args --target=x86_64-linux-gnu -std=c23 #include <limits.h> _Static_assert(CHAR_BIT == 8); _Static_assert(BOOL_WIDTH == 8); _Static_assert(CHAR_WIDTH == 8); _Static_assert(SCHAR_WIDTH == 8); _Static_assert(UCHAR_WIDTH == 8); _Static_assert(SHRT_WIDTH == 16); _Static_assert(INT_WIDTH == 32); _Static_assert(UINT_WIDTH == 32); _Static_assert(LONG_WIDTH == 64); _Static_assert(ULONG_WIDTH == 64); _Static_assert(UCHAR_MAX == 255); _Static_assert(SCHAR_MAX == 127); _Static_assert(USHRT_MAX == 65535); _Static_assert(SHRT_MAX == 32767); _Static_assert(INT_MAX == 2147483647); _Static_assert(LONG_MAX == 9223372036854775807L); _Static_assert(CHAR_MIN == -128); _Static_assert(SCHAR_MIN == -128); _Static_assert(SHRT_MIN == -32768); _Static_assert(INT_MIN == -2147483648); _Static_assert(LONG_MIN == -9223372036854775807L - 1L); _Static_assert(LLONG_MIN == -9223372036854775807L - 1L); _Static_assert(UINT_MAX == 4294967295U); _Static_assert(ULONG_MAX == 18446744073709551615UL); _Static_assert(ULLONG_MAX == 18446744073709551615UL);
0
repos/arocc/test
repos/arocc/test/cases/pragma warning and error.c
#pragma GCC #pragma GCC warning #pragma GCC warning non_string #pragma GCC warning "A warning" #pragma GCC warning ("Another" " warning") #pragma GCC error #pragma GCC error non_string #pragma GCC error ("An error") #pragma GCC error "Another" " error" #if 0 #pragma GCC error "Should not happen" #endif #define P(s) _Pragma(#s) #define foo(x) P(message #x) foo(bar 1) foo(baz 2) #warning foo \ bar #define EXPECTED_ERRORS "pragma warning and error.c:3:13: error: pragma warning requires string literal" \ "pragma warning and error.c:5:13: error: pragma warning requires string literal" \ "pragma warning and error.c:7:13: warning: A warning [-W#pragma-messages]" \ "pragma warning and error.c:9:13: warning: Another warning [-W#pragma-messages]" \ "pragma warning and error.c:11:13: error: pragma error requires string literal" \ "pragma warning and error.c:13:13: error: pragma error requires string literal" \ "pragma warning and error.c:15:13: error: An error" \ "pragma warning and error.c:17:13: error: Another error" \ "pragma warning and error.c:26:1: note: #pragma message: bar 1" \ "pragma warning and error.c:27:1: note: #pragma message: baz 2" \ "pragma warning and error.c:29:2: warning: foo bar [-W#warnings]" \
0
repos/arocc/test
repos/arocc/test/cases/zero length array.c
//aro-args -Wzero-length-array struct S { int x; int y[0]; }; void foo(void) { struct S s; s.y[2] = 5; int z[0]; z[5] = 2; } #define EXPECTED_ERRORS "zero length array.c:5:10: warning: zero size arrays are an extension [-Wzero-length-array]" \ "zero length array.c:11:10: warning: zero size arrays are an extension [-Wzero-length-array]" \
0
repos/arocc/test
repos/arocc/test/cases/containers.c
int IntTest; enum EnumTest { Begin, End, }; enum Foo { A = 13, B = A + 4, C, }; struct Foo a; struct StructTest{ union Bar { int a; }; int MemberTest, :0, , a: 2; _Static_assert(sizeof(struct StructTest), "foo"); }; void foo(void) { union StructTest { int b; }; } void bar(void) { struct Foo; { struct Foo { int a; }; } sizeof(struct Foo); StructTest a; } enum { D, }; struct { struct { int a; }; }; struct StructWithEnum{ enum { E = 5.f, }; }; enum { F = IntTest, }; union SomeUnion { int a; }; typedef union SomeUnion SomeUnion; typedef struct forward_struct forward_struct; struct forward_struct { forward_struct *a; }; typedef enum forward_enum forward_enum; enum forward_enum { forward_enum_a = sizeof(forward_enum *), }; void baz(void) { struct a {int a;} a; (void) a.a; } void foo(void); struct foo { int a; }; void foo(void) { foo(); } int len; struct S1 { void a(); void b; int c[len]; }; struct S2 { int a[]; }; struct S3 { int a[]; int b; }; struct S4 { int a[]; int b[]; int c; }; struct S5 { int a; int b[]; }; union U { int a[]; }; struct S { enum EnumTest1:2; }; struct A { struct B { int a; } a; } a1; struct B b1; void qux(void) { enum A; struct A e; } struct A; struct A a2; struct NoTrailingSemicolon { int a; int b }; #define EXPECTED_ERRORS "containers.c:15:8: error: use of 'Foo' with tag type that does not match previous definition" \ "containers.c:9:6: note: previous definition is here" \ "containers.c:15:12: error: tentative definition has type 'struct Foo' that is never completed" \ "containers.c:15:8: note: forward declaration of 'struct Foo'" \ "containers.c:20:6: warning: declaration does not declare anything [-Wmissing-declaration]" \ "containers.c:21:25: warning: declaration does not declare anything [-Wmissing-declaration]" \ "containers.c:22:20: error: invalid application of 'sizeof' to an incomplete type 'struct StructTest'" \ "containers.c:38:5: error: invalid application of 'sizeof' to an incomplete type 'struct Foo'" \ "containers.c:39:5: error: must use 'struct' tag to refer to type 'StructTest'" \ "containers.c:46:1: warning: declaration does not declare anything [-Wmissing-declaration]" \ "containers.c:54:13: error: expression is not an integer constant expression" \ "containers.c:59:9: error: enum value must be an integer constant expression" \ "containers.c:84:6: error: redefinition of 'foo'" \ "containers.c:25:6: note: previous definition is here" \ "containers.c:90:10: error: field declared as a function" \ "containers.c:91:10: error: field has incomplete type 'void'" \ "containers.c:92:9: error: variable length array fields extension is not supported" \ "containers.c:96:9: error: flexible array member in otherwise empty struct" \ "containers.c:100:9: error: flexible array member is not at the end of struct" \ "containers.c:105:9: error: flexible array member is not at the end of struct" \ "containers.c:106:9: error: flexible array member is not at the end of struct" \ "containers.c:116:9: error: flexible array member in union is not allowed" \ "containers.c:120:19: error: field has incomplete type 'enum EnumTest1'" \ "containers.c:132:12: error: use of 'A' with tag type that does not match previous definition" \ "containers.c:131:10: note: previous definition is here" \ "containers.c:132:14: error: variable has incomplete type 'struct A'" \ "containers.c:140:1: warning: expected ';' at end of declaration list" \
0
repos/arocc/test
repos/arocc/test/cases/__builtin_types_compatible_p.c
//aro-args -std=c23 #if !__has_builtin(__builtin_types_compatible_p) #error Missing builtin __builtin_types_compatible_p #endif typedef int *intptr; enum A { FOO, }; enum B { BAR, }; const int x; _Static_assert(__builtin_types_compatible_p(int, int)); _Static_assert(__builtin_types_compatible_p(const int, int)); _Static_assert(__builtin_types_compatible_p(intptr, int *)); _Static_assert(__builtin_types_compatible_p(int[], const int[])); _Static_assert(__builtin_types_compatible_p(__typeof__("Hello"), char[])); _Static_assert(__builtin_types_compatible_p(__typeof__("Hello"), char[6])); _Static_assert(__builtin_types_compatible_p(__typeof__(const int), int)); _Static_assert(__builtin_types_compatible_p(__typeof__(x), __typeof__(volatile int))); _Static_assert(!__builtin_types_compatible_p(const int*, int *)); _Static_assert(!__builtin_types_compatible_p(enum A, enum B)); _Static_assert(!__builtin_types_compatible_p(__typeof__("Hello"), char *)); _Static_assert(__builtin_types_compatible_p(int, long)); _Static_assert(__builtin_types_compatible_p(__typeof__(const int) *, int *), "Types do not match"); #define EXPECTED_ERRORS "__builtin_types_compatible_p.c:31:1: error: static assertion failed '__builtin_types_compatible_p(int, long)'" \ "__builtin_types_compatible_p.c:32:1: error: static assertion failed '__builtin_types_compatible_p(const int *, int *)' \"Types do not match\"" \
0
repos/arocc/test
repos/arocc/test/cases/gnu inline assembly statements.c
//aro-args --target=x86-linux-gnu -pedantic // Note: examples taken from here: https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html // Some examples do not use real instructions or register names, which may cause failures once we do // validation of the assembly #include <stdbool.h> int add(void) { int src = 1; int dst; __asm__("mov %1, %0\n\t" "add $1, %0" : "=r" (dst) : "r" (src)); return dst; } void names(void) { unsigned Mask = 1234; unsigned Index; __asm__ ("bsfl %[aMask], %[aIndex]" : [aIndex] "=r" (Index) : [aMask] "r" (Mask) : "cc"); } int with_goto(int p1, int p2) { __asm__ goto( "btl %1, %0\n\t" "jc %l2" : /* No outputs. */ : "r" (p1), "r" (p2) : "cc" : carry); return 0; carry: return 1; } bool constraint_expr(int *Base, unsigned Offset) { bool old; __asm__ ("btsl %2,%1\n\t" // Turn on zero-based bit #Offset in Base. "sbb %0,%0" // Use the CF to calculate old. : "=r" (old), "+rm" (*Base) : "Ir" (Offset) : "cc"); return old; } void foo(void) { unsigned c = 1; unsigned d; unsigned *e = &c; __asm__ ("mov %[e], %[d]" : [d] "=rm" (d) : [e] "rm" (*e)); } void no_outputs(unsigned Offset) { __asm__ ("some instructions" :: "r" (Offset / 8)); } int frob(int x) { int y; __asm__ goto ("frob %%r5, %1; jc %l[error]; mov (%2), %%r5" : /* No outputs. */ : "r"(x), "r"(&y) : "r5", "memory" : error); return y; error: return -1; } int bad_goto_label(int p1, int p2) { __asm__ goto( "btl %1, %0\n\t" "jc %l2" : /* No outputs. */ : "r" (p1), "r" (p2) : "cc" : carry_1); return 0; carry: return 1; } int missing_goto_kw(int p1, int p2) { __asm__( "btl %1, %0\n\t" "jc %l2" : /* No outputs. */ : "r" (p1), "r" (p2) : "cc" : carry); return 0; carry: return 1; } int missing_goto_label(int p1, int p2) { __asm__ goto( "btl %1, %0\n\t" "jc %l2" : /* No outputs. */ : "r" (p1), "r" (p2) : "cc" ); return 0; carry: return 1; } void extension_token(unsigned Offset) { asm volatile("some instructions" :: ); } #define EXPECTED_ERRORS "gnu inline assembly statements.c:90:11: error: use of undeclared label 'carry_1'" \ "gnu inline assembly statements.c:104:9: error: expected ')', found ':'" \ "gnu inline assembly statements.c:118:10: error: expected ':', found ')'" \ "gnu inline assembly statements.c:126:5: warning: extension used [-Wlanguage-extension-token]" \
0
repos/arocc/test
repos/arocc/test/cases/enum sizes linux.c
//aro-args --target=x86_64-linux-gnu enum Small { A } __attribute__((packed)); _Static_assert(sizeof(enum Small) == 1, "Small"); enum __attribute__((packed)) StillSmall { B = 255 }; _Static_assert(sizeof(enum StillSmall) == 1, "StillSmall"); enum Medium { C = 255, D } __attribute__((packed)); _Static_assert(sizeof(enum Medium) == 2, "Medium"); enum StillMedium { E = -32768, F = 32767 } __attribute__((packed)); _Static_assert(sizeof(enum StillMedium) == 2, "StillMedium"); enum Normal { G = -2147483648, H = 2147483647 }; _Static_assert(sizeof(enum Normal) == 4, "Normal"); enum Unsigned { I = 4294967295, }; _Static_assert(sizeof(enum Unsigned) == 4, "Unsigned"); enum Large { J = -1, K = 4294967295 }; _Static_assert(sizeof(enum Large) == 8, "Large"); enum Huge { L = 18446744073709551615ULL }; _Static_assert(sizeof(enum Huge) == 8, "Huge");
0
repos/arocc/test
repos/arocc/test/cases/nested macro call.c
//aro-args -E -P #define A(x) x #define B(x) A(x) B(B(x)) A(B(x))
0
repos/arocc/test
repos/arocc/test/cases/integer literal promotion warning clang.c
//aro-args --emulate=clang _Static_assert(__builtin_types_compatible_p(typeof(18446744073709550592), unsigned long long), ""); #define EXPECTED_ERRORS "integer literal promotion warning clang.c:3:52: warning: integer literal is too large to be represented in a signed integer type, interpreting as unsigned [-Wimplicitly-unsigned-literal]"
0
repos/arocc/test
repos/arocc/test/cases/unterminated macro function at eof gcc.c
//aro-args -E --emulate=gcc -P #define EXPECTED_ERRORS "unterminated macro function at eof gcc.c:5:1: error: unterminated function macro argument list" \ #define foo(X) X foo(1,
0
repos/arocc/test
repos/arocc/test/cases/binary expressions.c
void foo(void) { const volatile _Atomic long a; a | 2.f; (void)(a | (_Bool)2); (void)((char)a * 2.); (char)a * (int*)2; (void)(foo && (char)2); foo || (void)2; (void)((const int*)1 == (int *)1); (float*)1 == (int*)1; 1 == (int*)1; 1.0 == (int*)1; (_Complex double)1 < 1; (void)((int*)1 + 2); (int*)1 + (int*)2; (void)((int*)1 - 2); (void)((int*)1 - (int*)2); 1 - (int*)2; (int*)1 - (float*)2; 1 ? (void)2 : 3; 1 ? (int*)2 : 3; 1 ? 2 : (int*)3; (void)(1 ? (int*)2 : (int*)3); (void)(1 ? (int*)2 : (float*)3); (void)(1 ? (int*)2 : (const void*)3); (void)(1 ? (volatile int*)2 : (const void*)3); (void)(1 ? (const int *)1 : 0); (void)(1 ? 0 : (const int *)1); struct Foo { int a; } b; const struct Foo c; (void)(1 ? b : c); (void)(1 ? b : 1); ?:; (void)(1 * (int)sizeof(int)); int *ptr; char idx; ptr = ptr + idx; ,(void)1; (void)2,; (void)(ptr == 0); (void)(0 == ptr); } int bar(void) { return 1U < 2U; } int baz = 0xFFFFFFFFFFLL + 1u; int qux = 1/"foo"; int quux = "foo"?1:2; struct S { int x; }; void invalid_chained_comparisons() { struct S s = { .x = 1 }; 1.0 == s == 1; 1.0 < s == 1; 1.0 == &1 == 1; } void mod_assign_float(void) { int x = 1; x %= 1.0f; } void binary_conditional(void) { (void)(1 ?: 2.); (void)1.2 ?: (void)2; } struct Foo; int invalid_ptr_arithmetic(struct Foo *num) { return num - num; } void address_of_invalid_type(void) { char x[64]; char *y = &(x&x); } _Static_assert((1 ^ -1) == -2, ""); _Static_assert((0 ^ 0) == 0, ""); _Static_assert((-1 ^ 0) == -1, ""); _Static_assert((-1 ^ -1) == 0, ""); _Static_assert((-2 ^ 2) == -4, ""); _Static_assert(2.0||(2.0 == 2.0), ""); _Static_assert(2.0||(3.0 > 2.0), ""); _Static_assert(2.0||(2.0 && 2.0), ""); _Static_assert((-10 & -1) == -10, ""); #define EXPECTED_ERRORS "binary expressions.c:3:7: error: invalid operands to binary expression ('long' and 'float')" \ "binary expressions.c:6:13: error: invalid operands to binary expression ('char' and 'int *')" \ "binary expressions.c:8:9: error: invalid operands to binary expression ('void (*)(void)' and 'void')" \ "binary expressions.c:10:15: warning: comparison of distinct pointer types ('float *' and 'int *') [-Wcompare-distinct-pointer-types]" \ "binary expressions.c:11:7: warning: comparison between pointer and integer ('int' and 'int *') [-Wpointer-integer-compare]" \ "binary expressions.c:12:9: error: invalid operands to binary expression ('double' and 'int *')" \ "binary expressions.c:13:24: error: invalid operands to binary expression ('_Complex double' and 'int')" \ "binary expressions.c:15:13: error: invalid operands to binary expression ('int *' and 'int *')" \ "binary expressions.c:18:7: error: invalid operands to binary expression ('int' and 'int *')" \ "binary expressions.c:19:13: error: incompatible pointer types ('int *' and 'float *')" \ "binary expressions.c:21:17: warning: implicit integer to pointer conversion from 'int' to 'int *' [-Wint-conversion]" \ "binary expressions.c:22:11: warning: implicit integer to pointer conversion from 'int' to 'int *' [-Wint-conversion]" \ "binary expressions.c:24:24: warning: pointer type mismatch ('int *' and 'float *') [-Wpointer-type-mismatch]" \ "binary expressions.c:32:18: error: invalid operands to binary expression ('struct Foo' and 'int')" \ "binary expressions.c:33:5: error: expected statement" \ "binary expressions.c:38:5: error: expected expression" \ "binary expressions.c:39:13: error: expected expression" \ "binary expressions.c:48:11: warning: implicit conversion from 'long long' to 'int' changes non-zero value from 1099511627776 to 0 [-Wconstant-conversion]" \ "binary expressions.c:49:12: error: invalid operands to binary expression ('int' and 'char *')" \ "binary expressions.c:55:9: error: invalid operands to binary expression ('double' and 'struct S')" \ "binary expressions.c:56:9: error: invalid operands to binary expression ('double' and 'struct S')" \ "binary expressions.c:57:12: error: cannot take the address of an rvalue" \ "binary expressions.c:57:9: error: invalid operands to binary expression ('double' and 'int *')" \ "binary expressions.c:62:7: error: invalid operands to binary expression ('int' and 'float')" \ "binary expressions.c:67:5: error: used type 'void' where arithmetic or pointer type is required" \ "binary expressions.c:72:16: error: arithmetic on a pointer to an incomplete type 'struct Foo'" \ "binary expressions.c:77:18: error: invalid operands to binary expression ('char *' and 'char *')" \
0
repos/arocc/test
repos/arocc/test/cases/#pragma pack msvc.c
//aro-args --emulate=msvc struct A { char c; int x; }; struct B { #pragma pack(1) char c; int x; }; #pragma pack() struct C { char c; #pragma pack(1) int x; }; #pragma pack() struct D { char c; int x; #pragma pack(1) }; _Static_assert(sizeof(struct A) > sizeof(struct B), ""); _Static_assert(sizeof(struct B) == sizeof(struct C), ""); _Static_assert(sizeof(struct B) == sizeof(char) + sizeof(int), ""); // _Static_assert(sizeof(struct A) == sizeof(struct D), ""); #define TESTS_SKIPPED 1
0
repos/arocc/test
repos/arocc/test/cases/declspec.c
//aro-args -fdeclspec #pragma GCC diagnostic ignored "-Wgnu-alignof-expression" __declspec(align) int foo; __declspec(align(16)) int bar; __declspec(aligned(16)) int baz; _Static_assert(_Alignof(bar) == 16, "wrong alignment"); #if __has_declspec_attribute(foo) #error fail #endif #if !__has_declspec_attribute(align) #error fail #endif typedef int Int1 __declspec(align(8)); typedef __declspec(align(8)) int Int2; _Static_assert(_Alignof(Int2) == 8, ""); #define EXPECTED_ERRORS "declspec.c:7:12: warning: __declspec attribute 'aligned' is not supported [-Wignored-attributes]" \ "declspec.c:19:18: error: 'declspec' attribute not allowed after declarator" \ "declspec.c:19:13: note: this declarator"
0
repos/arocc/test
repos/arocc/test/cases/extended identifiers c11.c
//aro-args -std=c11 #pragma GCC diagnostic warning "-Wc99-compat" #define Ǻ 42 int fǿǿ(void) { int Ǿ = Ǻ; return Ǿ; } int bȁr(void) { int ™ = 0; return 0; } int bȁz(void) { int a١ = 0; int ١a = 0; return 0; } int invis­ible = 0; int homoglyph) = 1; struct gǿǿd { int ǿk; }; struct £ { int pounds; }; struct cents { int ¢; }; int あああ = "あああ" * 1; #define EXPECTED_ERRORS "extended identifiers c11.c:12:9: warning: using this character in an identifier is incompatible with C99 [-Wc99-compat]" \ "extended identifiers c11.c:22:10: warning: using this character in an identifier is incompatible with C99 [-Wc99-compat]" \ "extended identifiers c11.c:22:10: warning: identifier contains Unicode character <U+00AD> that is invisible in some environments [-Wunicode-homoglyph]" \ "extended identifiers c11.c:23:14: warning: using this character in an identifier is incompatible with C99 [-Wc99-compat]" \ "extended identifiers c11.c:23:14: warning: treating Unicode character <U+FF09> as identifier character rather than as ')' symbol [-Wunicode-homoglyph]" \ "extended identifiers c11.c:29:8: error: unexpected character <U+00A3>" \ "extended identifiers c11.c:29:1: warning: declaration does not declare anything [-Wmissing-declaration]" \ "extended identifiers c11.c:33:9: error: unexpected character <U+00A2>" \ "extended identifiers c11.c:33:10: warning: declaration does not declare anything [-Wmissing-declaration]" \ "extended identifiers c11.c:36:18: error: invalid operands to binary expression ('char *' and 'int')" \
0
repos/arocc/test
repos/arocc/test/cases/empty computed include.c
#define FOO #include FOO #define EXPECTED_ERRORS "empty computed include.c:2:10: error: expected \"FILENAME\" or <FILENAME>" \
0
repos/arocc/test
repos/arocc/test/cases/invalid epoch.c
//aro-env SOURCE_DATE_EPOCH=abc #define EXPECTED_ERRORS "error: environment variable SOURCE_DATE_EPOCH must expand to a non-negative integer less than or equal to 253402300799" \
0
repos/arocc/test
repos/arocc/test/cases/float to int.c
#pragma GCC diagnostic warning "-Wliteral-conversion" #pragma GCC diagnostic warning "-Wfloat-conversion" #pragma GCC diagnostic warning "-Wfloat-overflow-conversion" #pragma GCC diagnostic warning "-Wfloat-zero-conversion" void foo(void) { int a = 10000000000.0f; int b = 1.2f; int c = 0.0f / 0; int d = 5.0 / 2; int e = 1.0f / 2; int f = 2.0; int g = 2147483647.0f; char h = 256.0f; unsigned i = -1.0; _Bool j = 0.0; _Bool k = 1.0f; _Bool l = 1.5f; } #define EXPECTED_ERRORS \ "float to int.c:7:13: warning: implicit conversion of out of range value from 'float' to 'int' is undefined [-Wliteral-conversion]" \ "float to int.c:8:13: warning: implicit conversion from 'float' to 'int' changes value from 1.2 to 1 [-Wfloat-conversion]" \ "float to int.c:9:13: warning: implicit conversion of non-finite value from 'float' to 'int' is undefined [-Wfloat-overflow-conversion]" \ "float to int.c:10:13: warning: implicit conversion from 'double' to 'int' changes value from 2.5 to 2 [-Wfloat-conversion]" \ "float to int.c:11:13: warning: implicit conversion from 'float' to 'int' changes non-zero value from 0.5 to 0 [-Wfloat-zero-conversion]" \ "float to int.c:12:13: warning: implicit conversion turns floating-point number into integer: 'double' to 'int' [-Wliteral-conversion]" \ "float to int.c:13:13: warning: implicit conversion of out of range value from 'float' to 'int' is undefined [-Wliteral-conversion]" \ "float to int.c:14:14: warning: implicit conversion of out of range value from 'float' to 'char' is undefined [-Wliteral-conversion]" \ "float to int.c:15:18: warning: implicit conversion of out of range value from 'double' to 'unsigned int' is undefined [-Wliteral-conversion]" \ "float to int.c:16:15: warning: implicit conversion turns floating-point number into integer: 'double' to '_Bool' [-Wliteral-conversion]" \ "float to int.c:17:15: warning: implicit conversion turns floating-point number into integer: 'float' to '_Bool' [-Wliteral-conversion]" \ "float to int.c:18:15: warning: implicit conversion from 'float' to '_Bool' changes value from 1.5 to true [-Wfloat-conversion]" \
0
repos/arocc/test
repos/arocc/test/cases/spliced newline in string literal.c
#define NO_ERROR_VALIDATION "\\
0
repos/arocc/test
repos/arocc/test/cases/float header aarch64-linux-gnu.c
//aro-args -E --target=aarch64-linux-gnu -std=c11 -ffp-eval-method=extended -P #include <float.h> DBL_DIG DBL_EPSILON DBL_MANT_DIG DBL_MAX_10_EXP DBL_MAX_EXP DBL_MAX DBL_MIN_10_EXP DBL_MIN_EXP DBL_MIN DECIMAL_DIG FLT_DIG FLT_EPSILON FLT_MANT_DIG FLT_MAX_10_EXP FLT_MAX_EXP FLT_MAX FLT_MIN_10_EXP FLT_MIN_EXP FLT_MIN FLT_RADIX LDBL_DIG LDBL_EPSILON LDBL_MANT_DIG LDBL_MAX_10_EXP LDBL_MAX_EXP LDBL_MAX LDBL_MIN_10_EXP LDBL_MIN_EXP LDBL_MIN FLT_EVAL_METHOD
0
repos/arocc/test
repos/arocc/test/cases/_BitInt min max.c
//aro-args -std=c23 _Static_assert(-10 % -444444444444444442051616WB != 0, ""); enum E: _BitInt(512) { A = -6703903964971298549787012499102923063739682910296196688861780721860882015036773488400937149083451713845015929093243025426876941405973284973216824503042048WB, B = 6703903964971298549787012499102923063739682910296196688861780721860882015036773488400937149083451713845015929093243025426876941405973284973216824503042047WB, };
0
repos/arocc/test
repos/arocc/test/cases/float array size.c
void foo(float f) { int bar[2.0] = {0}; int baz[f]; } #define EXPECTED_ERRORS "float array size.c:2:13: error: size of array has non-integer type 'double'" \ "float array size.c:3:13: error: size of array has non-integer type 'float'" \
0
repos/arocc/test
repos/arocc/test/cases/return.c
_Bool b(void) { return; return 1; return 1.; return (int *)1l; return (void)1; } int i(void) { return 1; return 1.f; return (int*)1L; } float f(void) { return 1; return 1.f; return (int*)1L; } int *ip(void) { return 1; return (int*)1L; return (float*)2L; _Atomic int a[3]; return &a; } int foo(void) { } int bar(void) { return; } void baz(void) { return 1; } int *return_func(void)(void) { return 0; } char return_char(void) { return 1; } short return_short(void) { return 2; } int func1(int arg) { switch (arg) { case 1: return 1; case 2: return 2; default: return 3; } // no warning expected } int func2(int arg) { switch (arg) { case 1: func1(1); case 2: func1(2); default: func1(3); } return 1; // this is reachable } int func3(int arg) { switch (arg) return arg; return 1; // this is reachable } int then_noreturn(int arg) { if (arg) { return 2; } else { // do nothing } return 1; // reachable; no warning } int else_noreturn(int arg) { if (arg) { // do nothing } else { return 2; } return 1; // reachable; no warning } void *void_star_return(void) { return 4.2; } int *return_signed(unsigned int *x) { return x; } void call_return_signed(void) { unsigned int x = 0; int *y = return_signed(&x); } #define EXPECTED_ERRORS "return.c:2:5: error: non-void function 'b' should return a value [-Wreturn-type]" \ "return.c:3:5: warning: unreachable code [-Wunreachable-code]" \ "return.c:6:12: error: returning 'void' from a function with incompatible result type '_Bool'" \ "return.c:11:5: warning: unreachable code [-Wunreachable-code]" \ "return.c:12:12: warning: implicit pointer to integer conversion from 'int *' to 'int' [-Wint-conversion]" \ "return.c:17:5: warning: unreachable code [-Wunreachable-code]" \ "return.c:18:12: error: returning 'int *' from a function with incompatible result type 'float'" \ "return.c:22:12: warning: implicit integer to pointer conversion from 'int' to 'int *' [-Wint-conversion]" \ "return.c:23:5: warning: unreachable code [-Wunreachable-code]" \ "return.c:24:12: error: returning 'float *' from a function with incompatible result type 'int *'" \ "return.c:26:12: error: returning '_Atomic(int) (*)[3]' from a function with incompatible result type 'int *'" \ "return.c:30:1: warning: non-void function 'foo' does not return a value [-Wreturn-type]" \ "return.c:32:5: error: non-void function 'bar' should return a value [-Wreturn-type]" \ "return.c:35:12: error: void function 'baz' should not return a value [-Wreturn-type]" \ "return.c:38:17: error: function cannot return a function" \ "return.c:96:12: error: returning 'double' from a function with incompatible result type 'void *'" \ "return.c:100:12: warning: returning 'unsigned int *' from a function with incompatible result type 'int *' converts between pointers to integer types with different sign [-Wpointer-sign]" \
0
repos/arocc/test
repos/arocc/test/cases/float header x86-64-linux.c
//aro-args -E --target=x86_64-linux-gnu -std=c11 -P #include <float.h> DBL_DIG DBL_EPSILON DBL_MANT_DIG DBL_MAX_10_EXP DBL_MAX_EXP DBL_MAX DBL_MIN_10_EXP DBL_MIN_EXP DBL_MIN DECIMAL_DIG FLT_DIG FLT_EPSILON FLT_MANT_DIG FLT_MAX_10_EXP FLT_MAX_EXP FLT_MAX FLT_MIN_10_EXP FLT_MIN_EXP FLT_MIN FLT_RADIX LDBL_DIG LDBL_EPSILON LDBL_MANT_DIG LDBL_MAX_10_EXP LDBL_MAX_EXP LDBL_MAX LDBL_MIN_10_EXP LDBL_MIN_EXP LDBL_MIN FLT_EVAL_METHOD
0
repos/arocc/test
repos/arocc/test/cases/c23 digit separators.c
//aro-args -std=c23 _Static_assert(0b1001'0110 == 150); _Static_assert(1'2wb == 12);
0
repos/arocc/test
repos/arocc/test/cases/c23 char8_t.c
//aro-args -std=c23 void foo(void) { char8_t c = 0; } _Static_assert(_Generic(u8"hello", unsigned char*: 1, default: 2) == 1, "Incorrect type for u8 string literal"); _Static_assert(_Generic(u8"A"[0], unsigned char: 1, default: 2) == 1, "Incorrect type for u8 string literal element"); const char cbuf1[] = u8"text"; const char cbuf2[] = { u8"text" }; const signed char scbuf1[] = u8"text"; const signed char scbuf2[] = { u8"text" }; const unsigned char ucbuf1[] = u8"text"; const unsigned char ucbuf2[] = { u8"text" }; const char8_t c8buf1[] = u8"text"; const char8_t c8buf2[] = { u8"text" }; const char8_t c8buf3[] = "text"; const char8_t c8buf4[] = { "text" };
0
repos/arocc/test
repos/arocc/test/cases/spliced newline in char literal.c
#define NO_ERROR_VALIDATION '\\
0
repos/arocc/test
repos/arocc/test/cases/source epoch.c
//aro-args -E -P //aro-env SOURCE_DATE_EPOCH=0 __DATE__ __TIME__ __TIMESTAMP__
0
repos/arocc/test
repos/arocc/test/cases/redefinitions.c
int foo; enum { foo, foo, }; int foo; int bar; int bar = 1; int bar = 1; int baz; float baz; void func1(int foo, int foo); void func2(foo, foo); void func3(enum {foo} a, int foo); int func4(int[4][4]); int func4(int[4][4]); int func4(int[4][3]); int func5(int a) { int a; return a; } int func5(int a) { return 10; } int func5(int a); int arr[2]; int x = 0; arr[x]; int f1(const int); int f1(int a) { return a; } int f2(const int*); int f2(int *a) { return *a; } struct S { struct { int a; }; int a; float a; struct { struct { int a; }; }; }; typedef int MyInt; typedef float MyFloat; typedef MyFloat MyInt; typedef int MyOtherInt; typedef const int MyOtherInt; int f(int (*)(), double (*)[3]); int f(int (*)(char *), double (*)[]); double maximum(int n, int m, double a[n][m]); double maximum(int n, int m, double a[*][*]); double maximum(int n, int m, double a[ ][*]); double maximum(int n, int m, double a[ ][m]); void f3(double (* restrict a)[5]); void f3(double a[restrict][5]); void f3(double a[restrict 3][5]); void f3(double a[restrict static 3][5]); int f4(int, ...); int f4(int); int f5(int (*)(), double (*)[3]); int f5(int (*)(char), double (*)[]); // not compatible since char undergoes default argument promotion void f6(); void f6(void) {} void f7(void); void f7() {} int X; enum E { X = 4294967295, }; #define EXPECTED_ERRORS "redefinitions.c:4:5: error: redefinition of 'foo' as different kind of symbol" \ "redefinitions.c:1:5: note: previous definition is here" \ "redefinitions.c:5:5: error: redefinition of 'foo' as different kind of symbol" \ "redefinitions.c:1:5: note: previous definition is here" \ "redefinitions.c:12:5: error: redefinition of 'bar'" \ "redefinitions.c:11:5: note: previous definition is here" \ "redefinitions.c:15:7: error: redefinition of 'baz' with a different type" \ "redefinitions.c:14:5: note: previous definition is here" \ "redefinitions.c:17:25: error: redefinition of parameter 'foo'" \ "redefinitions.c:17:16: note: previous definition is here" \ "redefinitions.c:18:17: error: redefinition of parameter 'foo'" \ "redefinitions.c:18:12: note: previous definition is here" \ "redefinitions.c:18:12: error: identifier parameter lists are only allowed in function definitions" \ "redefinitions.c:19:30: error: redefinition of parameter 'foo'" \ "redefinitions.c:19:18: note: previous definition is here" \ "redefinitions.c:23:5: error: redefinition of 'func4' with a different type" \ "redefinitions.c:22:5: note: previous definition is here" \ "redefinitions.c:26:9: error: redefinition of 'a'" \ "redefinitions.c:25:15: note: previous definition is here" \ "redefinitions.c:30:5: error: redefinition of 'func5'" \ "redefinitions.c:25:5: note: previous definition is here" \ "redefinitions.c:38:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]" \ "redefinitions.c:38:1: error: variable length arrays not allowed at file scope" \ "redefinitions.c:45:5: error: redefinition of 'f2' with a different type" \ "redefinitions.c:44:5: note: previous definition is here" \ "redefinitions.c:53:9: error: duplicate member 'a'" \ "redefinitions.c:51:13: note: previous definition is here" \ "redefinitions.c:54:11: error: duplicate member 'a'" \ "redefinitions.c:53:9: note: previous definition is here" \ "redefinitions.c:57:17: error: duplicate member 'a'" \ "redefinitions.c:54:11: note: previous definition is here" \ "redefinitions.c:64:17: error: typedef redefinition with different types ('float' vs 'int')" \ "redefinitions.c:62:13: note: previous definition is here" \ "redefinitions.c:67:19: error: typedef redefinition with different types ('const int' vs 'int')" \ "redefinitions.c:66:13: note: previous definition is here" \ "redefinitions.c:83:5: error: redefinition of 'f4' with a different type" \ "redefinitions.c:82:5: note: previous definition is here" \ "redefinitions.c:86:5: error: redefinition of 'f5' with a different type" \ "redefinitions.c:85:5: note: previous definition is here" \ "redefinitions.c:96:5: error: redefinition of 'X' as different kind of symbol" \ "redefinitions.c:94:5: note: previous definition is here" \
0
repos/arocc/test
repos/arocc/test/cases/designated_init.c
union U { int a; float b; } __attribute__((designated_init)); struct S { int a; float b; } __attribute__((designated_init)) a = { 1 }; #define EXPECTED_ERRORS \ "designated_init.c:4:18: error: 'designated_init' attribute is only valid on 'struct' type'" \ "designated_init.c:8:42: warning: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Wdesignated-init]" \
0
repos/arocc/test
repos/arocc/test/cases/stdckdint.c
#include <stdckdint.h> enum E { A, }; void foo(void) { int x = 0; unsigned y = 2; _Bool b, overflowed; enum E e; unsigned res; const unsigned const_res; unsigned arr[2]; overflowed = ckd_add(&res, x, y); overflowed = ckd_sub(&res, x, y); overflowed = ckd_mul(&res, x, y); overflowed = ckd_add(arr, x, y); overflowed = ckd_add(res, x, y); // non-pointer result overflowed = ckd_sub(&res, 1.2, y); // non-int argument overflowed = ckd_mul(&b, x, y); // pointer to boolean result overflowed = ckd_add(&const_res, x, y); // pointer to const result overflowed = ckd_sub(&e, x, y); // pointer to enumerated result overflowed = ckd_mul((void *)&res, x, y); // pointer to non-int result } #define EXPECTED_ERRORS "stdckdint.c:21:18: error: result argument to overflow builtin must be a pointer to a non-const integer ('unsigned int' invalid)" \ "stdckdint.h:7:60: note: expanded from here" \ "stdckdint.c:21:26: note: expanded from here" \ "stdckdint.c:22:18: error: operand argument to overflow builtin must be an integer ('double' invalid)" \ "stdckdint.h:8:54: note: expanded from here" \ "stdckdint.c:22:32: note: expanded from here" \ "stdckdint.c:23:18: error: result argument to overflow builtin must be a pointer to a non-const integer ('_Bool *' invalid)" \ "stdckdint.h:9:60: note: expanded from here" \ "stdckdint.c:23:26: note: expanded from here" \ "stdckdint.c:24:18: error: result argument to overflow builtin must be a pointer to a non-const integer ('const unsigned int *' invalid)" \ "stdckdint.h:7:60: note: expanded from here" \ "stdckdint.c:24:26: note: expanded from here" \ "stdckdint.c:25:18: error: result argument to overflow builtin must be a pointer to a non-const integer ('enum E *' invalid)" \ "stdckdint.h:8:60: note: expanded from here" \ "stdckdint.c:25:26: note: expanded from here" \ "stdckdint.c:26:18: error: result argument to overflow builtin must be a pointer to a non-const integer ('void *' invalid)" \ "stdckdint.h:9:60: note: expanded from here" \ "stdckdint.c:26:26: note: expanded from here" \
0
repos/arocc/test
repos/arocc/test/cases/numbers.c
int a = 0b; int b = 0x; int c = 0b12; int d = 0b1.2; double e = 019.5; double f = 0x12.e; int g = 0128; int h = 0iull; int i = 1e; double j = 0x1p; int k = 123LLuf; float l = 12e+2f; float m = 12E-2f; float n = 0x12P+2; float o = 0x12p-2; _Static_assert(0xE+0xC == 0xE + 0xC, ""); double p = 0x1.ep-1; double q = 0x1.eP-1; double r = 0x1.Ep-1; double s = 0x1.EP-1; double t = 1.ep-1; double u = 1.pp-1; #define EXPECTED_ERRORS "numbers.c:1:9: error: invalid suffix 'b' on integer constant" \ "numbers.c:2:9: error: invalid suffix 'x' on integer constant" \ "numbers.c:3:9: error: invalid digit '2' in binary constant" \ "numbers.c:4:9: error: invalid suffix '.2' on integer constant" \ "numbers.c:6:12: error: hexadecimal floating constant requires an exponent" \ "numbers.c:7:9: error: invalid digit '8' in octal constant" \ "numbers.c:9:9: error: exponent has no digits" \ "numbers.c:10:12: error: exponent has no digits" \ "numbers.c:11:9: error: invalid suffix 'LLuf' on integer constant" \ "numbers.c:16:16: error: invalid suffix '+0xC' on integer constant" \ "numbers.c:21:12: error: exponent has no digits" \ "numbers.c:22:12: error: invalid suffix 'pp-1' on floating constant" \
0
repos/arocc/test
repos/arocc/test/cases/no inline asm.c
//aro-args -fno-gnu-inline-asm __asm__("foo"); __asm__(""); #define EXPECTED_ERRORS "no inline asm.c:3:8: error: GNU-style inline assembly is disabled" \
0
repos/arocc/test
repos/arocc/test/cases/binary literal.c
//aro-args -Wpedantic void foo() { 0b11; } #define EXPECTED_ERRORS "binary literal.c:3:3: warning: binary integer literals are a GNU extension [-Wgnu-binary-literal]"
0
repos/arocc/test
repos/arocc/test/cases/darwin __float128.c
//aro-args --target=x86_64-macos __float128 q = 0.0; #define EXPECTED_ERRORS "darwin __float128.c:2:1: error: __float128 is not supported on this target" \
0
repos/arocc/test
repos/arocc/test/cases/_Float16.c
//aro-args --target=x86_64-linux-gnu #include <stdarg.h> _Float16 foo(_Float16 x, _Float16 y) { return x + y ; } void bar(int x, ...) { va_list va; va_start(va, x); va_end(va); } void quux(void) { _Float16 f = 1.0f16; bar(1, f); // _Float16 does not promote to double when used as vararg } void conversions(void) { double d = 1.0; _Float16 f16 = 2.0f16; __fp16 fp16 = 0; d = d + f16; (void)(f16 + fp16); // _Float16 + __fp16 promotes both to float } #define TESTS_SKIPPED 1
0
repos/arocc/test
repos/arocc/test/cases/macro expansion exhaustion.c
//aro-args -E -P #define CREATE_CALL F #define F(x) (x + 2) CREATE_CALL(2)
0
repos/arocc/test
repos/arocc/test/cases/extension.c
__extension__; __extension__ int a; void foo(void) { __extension__ int a; __extension__; __extension__ 1; } struct Foo { __extension__; __extension__ int a; }; #pragma GCC diagnostic warning "-Wextra-semi" ; __extension__; __extension__ __extension__ _Static_assert(1, ""); __extension__ #define EXPECTED_ERRORS "extension.c:6:18: error: expected expression" \ "extension.c:7:5: warning: expression result unused [-Wunused-value]" \ "extension.c:11:18: error: expected a type" \ "extension.c:17:1: warning: extra ';' outside of a function [-Wextra-semi]" \ "extension.c:22:14: error: expected external declaration" \
0
repos/arocc/test
repos/arocc/test/cases/enum fixed _BitInt.c
enum E: _BitInt(20) { A, }; void foo(void) { enum E e = 1; int x = -e; }
0
repos/arocc/test/cases
repos/arocc/test/cases/include/incorrect_guard.h
#ifndef INCORRECT_GUARD_H // missing #define INCORRECT_GUARD_H int x = 42; #endif // INCORRECT_GUARD_H
0
repos/arocc/test/cases
repos/arocc/test/cases/include/global_var_once.h
#pragma once int once = 10;
0
repos/arocc/test/cases
repos/arocc/test/cases/include/my_include.h
#define FOO 1 #include_next <my_include.h> // test/cases/include/next/my_include.h #include_next <other.h> // test/cases/include/next/other.h #if __has_include_next(<foobar.h>) #error "Should not exist" #endif #if __has_include_next(<my_include.h>) #define HAS_INCLUDE_NEXT_WORKED 1 #endif #if __has_include_next("global_var.h") #error "Should not find this with include_next" #endif
0
repos/arocc/test/cases
repos/arocc/test/cases/include/global_var_once_pragma_operator.h
_Pragma("once") int once = 10;
0
repos/arocc/test/cases
repos/arocc/test/cases/include/test_helpers.h
#pragma once #define EXPECT_TYPE(EXPR, TYPE) _Static_assert(__builtin_types_compatible_p(__typeof__(EXPR), TYPE), "") #define CAT(X, Y) XCAT(X, Y) #define XCAT(X, Y) X ## Y #define STR(X) XSTR(X) #define XSTR(X) #X
0
repos/arocc/test/cases
repos/arocc/test/cases/include/other.h
#define OTHER_INCLUDED 1
0
repos/arocc/test/cases
repos/arocc/test/cases/include/global_var.h
int multiple = 10;
0
repos/arocc/test/cases
repos/arocc/test/cases/include/correct_guard.h
#ifndef CORRECT_GUARD_H #define CORRECT_GUARD_H int x = 42; #endif // CORRECT_GUARD_H
0
repos/arocc/test/cases/include
repos/arocc/test/cases/include/two spaces/three spaces.h
#define THREE_SPACES_H 1
0
repos/arocc/test/cases/include
repos/arocc/test/cases/include/ms-ext/include other.h
#include "include/other.h"
0
repos/arocc/test/cases/include
repos/arocc/test/cases/include/next/my_include.h
#define BAR 2
0
repos/arocc/test/cases/include
repos/arocc/test/cases/include/next/other.h
#if defined(OTHER_INCLUDED) #error should not have been included yet #endif #define NEXT_OTHER_INCLUDED 1
0
repos/arocc/test/cases
repos/arocc/test/cases/ast/__float80.c
fn_def: 'fn () void' name: foo body: compound_stmt: 'void' var: 'long double' name: x init: float_literal: 'long double' (value: 1) assign_expr: 'long double' lhs: decl_ref_expr: 'long double' lvalue name: x rhs: float_literal: 'long double' (value: 1) var: '_Complex long double' name: z assign_expr: '_Complex long double' lhs: decl_ref_expr: '_Complex long double' lvalue name: z rhs: imaginary_literal: '_Complex long double' (value: 0 + 1i) float_literal: 'long double' assign_expr: '_Complex long double' lhs: decl_ref_expr: '_Complex long double' lvalue name: z rhs: imaginary_literal: '_Complex long double' (value: 0 + 1i) float_literal: 'long double' implicit_return: 'void'
0
repos/arocc/test/cases
repos/arocc/test/cases/ast/float eval method.c
fn_def: 'fn () void' name: foo body: compound_stmt: 'void' var: 'float' name: a init: float_literal: 'float' (value: 1) var: 'float' name: b init: float_literal: 'float' (value: 2) var: 'float' name: c init: implicit_cast: (float_cast) 'float' add_expr: 'double' lhs: implicit_cast: (float_cast) 'double' implicit_cast: (lval_to_rval) 'float' decl_ref_expr: 'float' lvalue name: a rhs: implicit_cast: (float_cast) 'double' implicit_cast: (lval_to_rval) 'float' decl_ref_expr: 'float' lvalue name: b var: '_Complex float' name: ca init: implicit_cast: (real_to_complex_float) '_Complex float' float_literal: 'float' (value: 0) assign_expr: '_Complex float' lhs: decl_ref_expr: '_Complex float' lvalue name: ca rhs: implicit_cast: (complex_float_cast) '_Complex float' add_expr: '_Complex double' lhs: implicit_cast: (complex_float_cast) '_Complex double' implicit_cast: (lval_to_rval) '_Complex float' decl_ref_expr: '_Complex float' lvalue name: ca rhs: implicit_cast: (real_to_complex_float) '_Complex double' implicit_cast: (float_cast) 'double' implicit_cast: (lval_to_rval) 'float' decl_ref_expr: 'float' lvalue name: a implicit_return: 'void'
0
repos/arocc/test/cases
repos/arocc/test/cases/ast/c23 true false ast.c
var: 'bool' name: a init: bool_literal: 'bool' (value: true) var: 'bool' name: b init: bool_literal: 'bool' (value: false) var: 'bool' name: c init: implicit_cast: (int_to_bool) 'bool' int_literal: 'int' (value: 0) var: 'bool' name: d init: implicit_cast: (int_to_bool) 'bool' int_literal: 'int' (value: 1) var: 'int' name: e init: implicit_cast: (bool_to_int) 'int' bool_literal: 'bool' (value: true) var: 'int' name: f init: implicit_cast: (bool_to_int) 'int' bool_literal: 'bool' (value: false) var: 'int' name: g init: add_expr: 'int' lhs: implicit_cast: (bool_to_int) 'int' bool_literal: 'bool' (value: true) rhs: int_literal: 'int' (value: 1)
0
repos/arocc/test/cases
repos/arocc/test/cases/ast/stdckdint_ast.c
fn_def: 'fn () void' name: foo body: compound_stmt: 'void' var: 'char' name: x init: implicit_cast: (int_cast) 'char' int_literal: 'int' (value: 0) var: 'unsigned int' name: y init: implicit_cast: (int_cast) 'unsigned int' int_literal: 'int' (value: 2) var: '_Bool' name: overflowed var: 'long' name: res assign_expr: '_Bool' lhs: decl_ref_expr: '_Bool' lvalue name: overflowed rhs: builtin_call_expr: '_Bool' name: __builtin_add_overflow args: implicit_cast: (lval_to_rval) 'char' decl_ref_expr: 'char' lvalue name: x implicit_cast: (lval_to_rval) 'unsigned int' decl_ref_expr: 'unsigned int' lvalue name: y addr_of_expr: '*long' operand: decl_ref_expr: 'long' lvalue name: res assign_expr: '_Bool' lhs: decl_ref_expr: '_Bool' lvalue name: overflowed rhs: builtin_call_expr: '_Bool' name: __builtin_sub_overflow args: implicit_cast: (lval_to_rval) 'char' decl_ref_expr: 'char' lvalue name: x implicit_cast: (lval_to_rval) 'unsigned int' decl_ref_expr: 'unsigned int' lvalue name: y addr_of_expr: '*long' operand: decl_ref_expr: 'long' lvalue name: res assign_expr: '_Bool' lhs: decl_ref_expr: '_Bool' lvalue name: overflowed rhs: builtin_call_expr: '_Bool' name: __builtin_mul_overflow args: implicit_cast: (lval_to_rval) 'char' decl_ref_expr: 'char' lvalue name: x implicit_cast: (lval_to_rval) 'unsigned int' decl_ref_expr: 'unsigned int' lvalue name: y addr_of_expr: '*long' operand: decl_ref_expr: 'long' lvalue name: res implicit_return: 'void'
0
repos/arocc/test/cases
repos/arocc/test/cases/ast/cast kinds.c
union_decl_two: 'union U' record_field_decl: 'int' name: x record_field_decl: 'float' name: y fn_def: 'fn () int' name: bar body: compound_stmt_two: 'void' return_stmt: 'void' expr: int_literal: 'int' (value: 42) fn_def: 'fn () void' name: foo body: compound_stmt: 'void' var: 'int' name: x var: 'float' name: f var: 'double' name: d var: '[2]int' name: arr var: '*int' name: p assign_expr: '*int' lhs: decl_ref_expr: '*int' lvalue name: p rhs: explicit_cast: (bitcast) '*int' addr_of_expr: '*float' operand: decl_ref_expr: 'float' lvalue name: f assign_expr: '*int' lhs: decl_ref_expr: '*int' lvalue name: p rhs: implicit_cast: (array_to_pointer) '*d[2]int' decl_ref_expr: '[2]int' lvalue name: arr assign_expr: 'int' lhs: decl_ref_expr: 'int' lvalue name: x rhs: call_expr_one: 'int' lhs: implicit_cast: (function_to_pointer) '*fn () int' decl_ref_expr: 'fn () int' lvalue name: bar var: '_Bool' name: b init: implicit_cast: (pointer_to_bool) '_Bool' implicit_cast: (lval_to_rval) '*int' decl_ref_expr: '*int' lvalue name: p assign_expr: 'int' lhs: decl_ref_expr: 'int' lvalue name: x rhs: implicit_cast: (pointer_to_int) 'int' implicit_cast: (lval_to_rval) '*int' decl_ref_expr: '*int' lvalue name: p assign_expr: 'int' lhs: decl_ref_expr: 'int' lvalue name: x rhs: implicit_cast: (bool_to_int) 'int' implicit_cast: (lval_to_rval) '_Bool' decl_ref_expr: '_Bool' lvalue name: b assign_expr: 'float' lhs: decl_ref_expr: 'float' lvalue name: f rhs: implicit_cast: (bool_to_float) 'float' implicit_cast: (lval_to_rval) '_Bool' decl_ref_expr: '_Bool' lvalue name: b assign_expr: '*int' lhs: decl_ref_expr: '*int' lvalue name: p rhs: implicit_cast: (bool_to_pointer) '*int' implicit_cast: (lval_to_rval) '_Bool' decl_ref_expr: '_Bool' lvalue name: b assign_expr: '_Bool' lhs: decl_ref_expr: '_Bool' lvalue name: b rhs: implicit_cast: (int_to_bool) '_Bool' implicit_cast: (lval_to_rval) 'int' decl_ref_expr: 'int' lvalue name: x assign_expr: 'float' lhs: decl_ref_expr: 'float' lvalue name: f rhs: implicit_cast: (int_to_float) 'float' implicit_cast: (lval_to_rval) 'int' decl_ref_expr: 'int' lvalue name: x assign_expr: '*int' lhs: decl_ref_expr: '*int' lvalue name: p rhs: implicit_cast: (int_to_pointer) '*int' implicit_cast: (lval_to_rval) 'int' decl_ref_expr: 'int' lvalue name: x assign_expr: '_Bool' lhs: decl_ref_expr: '_Bool' lvalue name: b rhs: implicit_cast: (float_to_bool) '_Bool' implicit_cast: (lval_to_rval) 'float' decl_ref_expr: 'float' lvalue name: f assign_expr: 'int' lhs: decl_ref_expr: 'int' lvalue name: x rhs: implicit_cast: (float_to_int) 'int' implicit_cast: (lval_to_rval) 'float' decl_ref_expr: 'float' lvalue name: f assign_expr: 'int' lhs: decl_ref_expr: 'int' lvalue name: x rhs: implicit_cast: (int_cast) 'int' int_literal: 'long' (value: 1) assign_expr: 'float' lhs: decl_ref_expr: 'float' lvalue name: f rhs: implicit_cast: (float_cast) 'float' implicit_cast: (lval_to_rval) 'double' decl_ref_expr: 'double' lvalue name: d assign_expr: 'double' lhs: decl_ref_expr: 'double' lvalue name: d rhs: implicit_cast: (float_cast) 'double' implicit_cast: (lval_to_rval) 'float' decl_ref_expr: 'float' lvalue name: f assign_expr: '*int' lhs: decl_ref_expr: '*int' lvalue name: p rhs: implicit_cast: (null_to_pointer) '*int' int_literal: 'int' (value: 0) explicit_cast: (to_void) 'void' implicit_cast: (lval_to_rval) '*int' decl_ref_expr: '*int' lvalue name: p var: 'union U' name: u assign_expr: 'union U' lhs: decl_ref_expr: 'union U' lvalue name: u rhs: explicit_cast: (union_cast) 'union U' implicit_cast: (lval_to_rval) 'int' decl_ref_expr: 'int' lvalue name: x assign_expr: 'union U' lhs: decl_ref_expr: 'union U' lvalue name: u rhs: explicit_cast: (union_cast) 'union U' implicit_cast: (lval_to_rval) 'float' decl_ref_expr: 'float' lvalue name: f implicit_return: 'void'
0
repos/arocc/test/cases
repos/arocc/test/cases/ast/promotion edge cases.c
struct_decl_two: 'struct S' record_field_decl: 'unsigned int' name: x bits: int_literal: 'int' (value: 3) record_field_decl: 'long' name: y bits: int_literal: 'int' (value: 5) fn_def: 'fn () void' name: foo body: compound_stmt: 'void' var: 'char' name: c init: implicit_cast: (int_cast) 'char' int_literal: 'int' (value: 0) var: 'double' name: d init: float_literal: 'double' (value: 2) assign_expr: 'double' lhs: decl_ref_expr: 'double' lvalue name: d rhs: add_expr: 'double' lhs: implicit_cast: (lval_to_rval) 'double' decl_ref_expr: 'double' lvalue name: d rhs: implicit_cast: (int_to_float) 'double' implicit_cast: (int_cast) 'int' implicit_cast: (lval_to_rval) 'char' decl_ref_expr: 'char' lvalue name: c var: 'struct S' name: s init: struct_init_expr_two: 'struct S' int_literal: 'unsigned int' (value: 1) int_literal: 'long' (value: 1) var: 'int' name: x init: add_expr: 'int' lhs: implicit_cast: (int_cast) 'int' implicit_cast: (lval_to_rval) 'unsigned int' member_access_expr: 'unsigned int' lvalue bitfield lhs: decl_ref_expr: 'struct S' lvalue name: s name: x rhs: int_literal: 'int' (value: 1) var: 'int' name: y init: add_expr: 'int' lhs: implicit_cast: (int_cast) 'int' implicit_cast: (lval_to_rval) 'long' member_access_expr: 'long' lvalue bitfield lhs: decl_ref_expr: 'struct S' lvalue name: s name: y rhs: int_literal: 'int' (value: 1) var: '__fp16' name: fp16 init: implicit_cast: (float_cast) '__fp16' float_literal: 'float' (value: 0) assign_expr: '__fp16' lhs: decl_ref_expr: '__fp16' lvalue name: fp16 rhs: implicit_cast: (float_cast) '__fp16' add_expr: 'float' lhs: implicit_cast: (float_cast) 'float' implicit_cast: (lval_to_rval) '__fp16' decl_ref_expr: '__fp16' lvalue name: fp16 rhs: implicit_cast: (float_cast) 'float' implicit_cast: (lval_to_rval) '__fp16' decl_ref_expr: '__fp16' lvalue name: fp16 implicit_return: 'void'
0
repos/arocc/test/cases
repos/arocc/test/cases/ast/c23 auto.c
fn_def: 'fn () void' name: bad body: compound_stmt: 'void' var: 'invalid' name: a var: 'int' name: b init: int_literal: 'int' (value: 1) var: 'int' name: c init: int_literal: 'int' (value: 2) var: 'int' name: d init: int_literal: 'int' (value: 3) implicit_return: 'void' fn_def: 'fn () void' name: good body: compound_stmt: 'void' var: 'int' name: a init: int_literal: 'int' (value: 1) var: '*d[4]char' name: b init: implicit_cast: (array_to_pointer) '*d[4]char' string_literal_expr: '[4]char' lvalue (value: "foo") var: '*fn () void' name: c init: implicit_cast: (function_to_pointer) '*fn () void' decl_ref_expr: 'fn () void' lvalue name: good implicit_return: 'void'
0
repos/arocc/test/cases
repos/arocc/test/cases/ast/attributed record fields.c
struct_decl_two: 'struct S1' struct_decl_two: 'struct S2' record_field_decl: 'int' name: x field attr: packed struct_decl_two: 'struct S3' record_field_decl: 'int' name: x field attr: packed struct_decl_two: 'struct S4' record_field_decl: 'int' name: x field attr: packed struct_decl_two: 'struct S5' record_field_decl: 'int' name: x field attr: packed record_field_decl: 'int' name: y field attr: packed struct_decl_two: 'struct S6' record_field_decl: 'int' name: x field attr: packed record_field_decl: 'int' name: y field attr: packed struct_decl_two: 'struct S7' record_field_decl: 'int' name: x field attr: packed record_field_decl: 'int' name: y struct_decl_two: 'struct S8' record_field_decl: 'int' name: x record_field_decl: 'int' name: y field attr: packed struct_decl: 'struct S9' record_field_decl: 'int' name: x field attr: packed field attr: aligned alignment: null record_field_decl: 'float' name: f record_field_decl: 'long' name: l field attr: packed field attr: aligned alignment: aro.Attribute.Alignment{ .node = aro.Tree.NodeIndex.none, .requested = 16 } field attr: warn_if_not_aligned alignment: aro.Attribute.Alignment{ .node = aro.Tree.NodeIndex.none, .requested = 16 } union_decl: 'union U1' record_field_decl: 'long' name: x record_field_decl: 'int' name: y field attr: aligned alignment: aro.Attribute.Alignment{ .node = aro.Tree.NodeIndex.none, .requested = 32 } record_field_decl: 'unsigned int' name: z field attr: packed union_decl: 'union U2' record_field_decl: 'int' name: x field attr: packed record_field_decl: 'int' name: y record_field_decl: 'int' name: z field attr: packed record_field_decl: 'int' name: w field attr: aligned alignment: null
0
repos/arocc/test/cases
repos/arocc/test/cases/ast/types.c
var: 'attributed(int)' attr: aligned alignment: aro.Attribute.Alignment{ .node = aro.Tree.NodeIndex.none, .requested = 4 } attr: aligned alignment: aro.Attribute.Alignment{ .node = aro.Tree.NodeIndex.none, .requested = 4 } attr: aligned alignment: aro.Attribute.Alignment{ .node = aro.Tree.NodeIndex(1), .requested = 16 } name: a var: 'const volatile int' name: b var: 'const volatile int' name: c var: 'const volatile int' name: d fn_proto: 'fn (a: restrict *int, b: restrict *int, c: restrict *int) int' name: foo fn_proto: 'fn (n: int, bar: *d[<expr>]int) int' name: bar typedef: 'void' name: baz fn_proto: 'attributed(fn () void)' attr: noreturn name: abort typedef: 'int' name: A typedef: 'int' name: B typedef: 'int' name: C typedef: 'int' name: B typedef: '[2]int' name: I fn_def: 'fn (a: *d[2]const int, b: *d[2]const int) void' name: qux body: compound_stmt: 'void' add_assign_expr: '*d[2]const int' lhs: decl_ref_expr: '*d[2]const int' lvalue name: b rhs: implicit_cast: (int_to_pointer) '*d[2]const int' int_literal: 'int' (value: 1) add_assign_expr: '*d[2]const int' lhs: decl_ref_expr: '*d[2]const int' lvalue name: a rhs: implicit_cast: (int_to_pointer) '*d[2]const int' int_literal: 'int' (value: 1) implicit_return: 'void' enum_decl_two: 'enum E: unsigned int' enum_field_decl: 'int' (value: 2) name: D value: implicit_cast: (int_cast) 'int' explicit_cast: (int_cast) 'char' (value: 2) int_literal: 'int' (value: 2) enum_field_decl: 'int' (value: 3) name: E value: implicit_cast: (int_cast) 'int' explicit_cast: (int_cast) 'long' (value: 3) int_literal: 'int' (value: 3)
0
repos/arocc/test/cases
repos/arocc/test/cases/ast/decayed attributed array.c
var: 'attributed([1]int)' attr: aligned alignment: null name: arr init: array_init_expr_two: '[1]int' int_literal: 'int' (value: 0) var: '*int' name: ptr init: implicit_cast: (array_to_pointer) '*d:attributed([1]int)' attr: aligned alignment: null decl_ref_expr: 'attributed([1]int)' lvalue attr: aligned alignment: null name: arr fn_def: 'fn () void' name: foo body: compound_stmt: 'void' var: 'attributed([64]char)' attr: aligned alignment: aro.Attribute.Alignment{ .node = aro.Tree.NodeIndex(9), .requested = 8 } name: x var: '*char' name: y init: addr_of_expr: '*char' operand: array_access_expr: 'char' lvalue lhs: implicit_cast: (array_to_pointer) '*d:attributed([64]char)' attr: aligned alignment: aro.Attribute.Alignment{ .node = aro.Tree.NodeIndex(9), .requested = 8 } paren_expr: 'attributed([64]char)' lvalue attr: aligned alignment: aro.Attribute.Alignment{ .node = aro.Tree.NodeIndex(9), .requested = 8 } operand: decl_ref_expr: 'attributed([64]char)' lvalue attr: aligned alignment: aro.Attribute.Alignment{ .node = aro.Tree.NodeIndex(9), .requested = 8 } name: x index: int_literal: 'int' (value: 0) implicit_return: 'void'
0
repos/arocc/test/cases
repos/arocc/test/cases/ast/generic ast.c
var: 'int' name: x init: generic_expr: 'int' controlling: int_literal: 'int' (value: 5) chosen: generic_association_expr: 'int' int_literal: 'int' (value: 42) rest: generic_association_expr: 'double' float_literal: 'double' (value: 32.5) var: 'int' name: y init: generic_expr: 'int' controlling: int_literal: 'int' (value: 5) chosen: generic_association_expr: 'int' int_literal: 'int' (value: 42) rest: generic_association_expr: 'double' float_literal: 'double' (value: 32.5) generic_default_expr: '[7]char' string_literal_expr: '[7]char' lvalue (value: "string") var: 'double' name: z init: implicit_cast: (int_to_float) 'double' generic_expr_one: 'int' controlling: int_literal: 'int' (value: 5) chosen: int_literal: 'int' (value: 32)
0
repos/arocc/test/cases
repos/arocc/test/cases/ast/native half type.c
fn_def: 'fn () void' name: foo body: compound_stmt: 'void' var: '__fp16' name: x init: implicit_cast: (float_cast) '__fp16' float_literal: 'float' (value: 1) var: '__fp16' name: y init: implicit_cast: (float_cast) '__fp16' float_literal: 'float' (value: 2) assign_expr: '__fp16' lhs: decl_ref_expr: '__fp16' lvalue name: x rhs: add_expr: '__fp16' lhs: implicit_cast: (lval_to_rval) '__fp16' decl_ref_expr: '__fp16' lvalue name: x rhs: implicit_cast: (lval_to_rval) '__fp16' decl_ref_expr: '__fp16' lvalue name: y implicit_return: 'void'
0
repos/arocc/test/cases
repos/arocc/test/cases/ast/typeof_unqual.c
var: 'const int' name: a var: 'typeof(<expr>: const int)' name: b var: 'typeof(<expr>: int)' name: c
0
repos/arocc/test/cases
repos/arocc/test/cases/ast/complex init.c
fn_def: 'fn () void' name: foo body: compound_stmt: 'void' var: '_Complex double' name: cd init: array_init_expr_two: '_Complex double' float_literal: 'double' (value: 1) float_literal: 'double' (value: 2) var: '_Complex float' name: cf init: array_init_expr_two: '_Complex float' float_literal: 'float' (value: 1) float_literal: 'float' (value: 2) assign_expr: '_Complex double' lhs: decl_ref_expr: '_Complex double' lvalue name: cd rhs: builtin_call_expr: '_Complex double' name: __builtin_complex args: float_literal: 'double' (value: 1) float_literal: 'double' (value: 2) assign_expr: '_Complex float' lhs: decl_ref_expr: '_Complex float' lvalue name: cf rhs: builtin_call_expr: '_Complex float' name: __builtin_complex args: float_literal: 'float' (value: 1) float_literal: 'float' (value: 2) assign_expr: '_Complex double' lhs: decl_ref_expr: '_Complex double' lvalue name: cd rhs: implicit_cast: (lval_to_rval) '_Complex double' compound_literal_expr: '_Complex double' lvalue array_init_expr_two: '_Complex double' implicit_cast: (float_cast) 'double' float_literal: 'float' (value: 1) implicit_cast: (float_cast) 'double' float_literal: 'float' (value: 2) assign_expr: '_Complex float' lhs: decl_ref_expr: '_Complex float' lvalue name: cf rhs: implicit_cast: (lval_to_rval) '_Complex float' compound_literal_expr: '_Complex float' lvalue array_init_expr_two: '_Complex float' implicit_cast: (float_cast) 'float' float_literal: 'double' (value: 1) implicit_cast: (float_cast) 'float' float_literal: 'double' (value: 2) implicit_return: 'void'
0
repos/arocc/test/cases
repos/arocc/test/cases/ast/vectors.c
typedef: 'float' name: invalid2 typedef: 'vector(2, float)' name: f2v fn_def: 'fn () void' name: foo body: compound_stmt: 'void' var: 'vector(2, float)' name: a var: 'vector(2, float)' name: b assign_expr: 'vector(2, float)' lhs: decl_ref_expr: 'vector(2, float)' lvalue name: a rhs: implicit_cast: (lval_to_rval) 'vector(2, float)' decl_ref_expr: 'vector(2, float)' lvalue name: b mul_assign_expr: 'vector(2, float)' lhs: decl_ref_expr: 'vector(2, float)' lvalue name: a rhs: implicit_cast: (vector_splat) 'float' implicit_cast: (int_to_float) 'float' (value: 2) int_literal: 'int' (value: 2) implicit_return: 'void'
0
repos/arocc/test/cases
repos/arocc/test/cases/ast/_Float16.c
typedef: '[1]struct __va_list_tag' name: va_list typedef: '[1]struct __va_list_tag' name: __gnuc_va_list fn_def: 'fn (x: _Float16, y: _Float16) _Float16' name: foo body: compound_stmt_two: 'void' return_stmt: 'void' expr: add_expr: '_Float16' lhs: implicit_cast: (lval_to_rval) '_Float16' decl_ref_expr: '_Float16' lvalue name: x rhs: implicit_cast: (lval_to_rval) '_Float16' decl_ref_expr: '_Float16' lvalue name: y fn_def: 'fn (x: int, ...) void' name: bar body: compound_stmt: 'void' var: '[1]struct __va_list_tag' name: va builtin_call_expr: 'void' name: __builtin_va_start args: implicit_cast: (array_to_pointer) '*d[1]struct __va_list_tag' decl_ref_expr: '[1]struct __va_list_tag' lvalue name: va decl_ref_expr: 'int' lvalue name: x builtin_call_expr_one: 'void' name: __builtin_va_end arg: implicit_cast: (array_to_pointer) '*d[1]struct __va_list_tag' decl_ref_expr: '[1]struct __va_list_tag' lvalue name: va implicit_return: 'void' fn_def: 'fn () void' name: quux body: compound_stmt: 'void' var: '_Float16' name: f init: float_literal: '_Float16' (value: 1) call_expr: 'void' lhs: implicit_cast: (function_to_pointer) '*fn (x: int, ...) void' decl_ref_expr: 'fn (x: int, ...) void' lvalue name: bar args: int_literal: 'int' (value: 1) implicit_cast: (lval_to_rval) '_Float16' decl_ref_expr: '_Float16' lvalue name: f implicit_return: 'void' fn_def: 'fn () void' name: conversions body: compound_stmt: 'void' var: 'double' name: d init: float_literal: 'double' (value: 1) var: '_Float16' name: f16 init: float_literal: '_Float16' (value: 2) var: '__fp16' name: fp16 init: implicit_cast: (int_to_float) '__fp16' int_literal: 'int' (value: 0) assign_expr: 'double' lhs: decl_ref_expr: 'double' lvalue name: d rhs: add_expr: 'double' lhs: implicit_cast: (lval_to_rval) 'double' decl_ref_expr: 'double' lvalue name: d rhs: implicit_cast: (float_cast) 'double' implicit_cast: (lval_to_rval) '_Float16' decl_ref_expr: '_Float16' lvalue name: f16 explicit_cast: (to_void) 'void' paren_expr: 'float' operand: add_expr: 'float' lhs: implicit_cast: (float_cast) 'float' implicit_cast: (lval_to_rval) '_Float16' decl_ref_expr: '_Float16' lvalue name: f16 rhs: implicit_cast: (float_cast) 'float' implicit_cast: (lval_to_rval) '__fp16' decl_ref_expr: '__fp16' lvalue name: fp16 implicit_return: 'void'
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/function macro expansion.c
"HI THERE" HI_THERE "HI THERE" 1, (2, 3) S()
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/recursive func macro.c
F(1)
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/#ifdef.c
long int
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/placeholder tokens pasting.c
x x y x ()x (y) (x)
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/#elifndef.c
int long
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/macro unbalanced parens call.c
FIRST 42
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/multiline comment.c
int I_exist; int x; int y; int foo ; int bar;
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/__has_attribute with define.c
1 1 + 0 1 1
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/line counter.c
3 0 4 1 4 2
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/X macro.c
enum Foo { Foo_1 = 1, Foo_2 = 2, Foo_3 = 3, Foo_4 = 4, Foo_5 = 5, };
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/deferred macro expansion.c
F_HOOK ()(XXX)
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/recursive call non-expanded parens.c
1 2 1 bar
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/whitespace macro arguments.c
1 1 q 1 1 2 3 3
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/nested unterminated macro gcc.c
"str" str
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/object macro expansion.c
a 1 define
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/macro expansion disabled.c
1 LOOP_INDIRECTION () (1) 123
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/__line__.c
void foo(void) { int x = 7; int y = 11; int z = 13; }
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/macro self definition.c
FOO BAR BAZ
0
repos/arocc/test/cases
repos/arocc/test/cases/expanded/lazy macro.c
REC_0_HOOK ()