From e51ac7ec7d3e32e1771c9f824da3dc7e4dcd2bc5 Mon Sep 17 00:00:00 2001 From: lemon Date: Sat, 13 Dec 2025 19:21:04 +0100 Subject: add c-testsuite --- .../external/c-testsuite/tests/single-exec/00210.c | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 test/external/c-testsuite/tests/single-exec/00210.c (limited to 'test/external/c-testsuite/tests/single-exec/00210.c') diff --git a/test/external/c-testsuite/tests/single-exec/00210.c b/test/external/c-testsuite/tests/single-exec/00210.c new file mode 100644 index 0000000..7faeaf5 --- /dev/null +++ b/test/external/c-testsuite/tests/single-exec/00210.c @@ -0,0 +1,40 @@ +typedef unsigned short uint16_t; +typedef unsigned char uint8_t; + +typedef union Unaligned16a { + uint16_t u; + uint8_t b[2]; +} __attribute__((packed)) Unaligned16a; + +typedef union __attribute__((packed)) Unaligned16b { + uint16_t u; + uint8_t b[2]; +} Unaligned16b; + +extern void foo (void) __attribute__((stdcall)); +void __attribute__((stdcall)) foo (void) +{ +} + +/* The actual attribute isn't important, must just be + parsable. */ +#define ATTR __attribute__((__noinline__)) +int ATTR actual_function() { + return 42; +} + +extern int printf (const char *, ...); +int main() +{ + void *function_pointer = &actual_function; + + int a = ((ATTR int(*) (void)) function_pointer)(); + printf("%i\n", a); + + /* In the following we once misparsed 'ATTR *' is a btype + and hence the whole type was garbled. */ + int b = ( (int(ATTR *)(void)) function_pointer)(); + printf("%i\n", b); + + return 0; +} -- cgit v1.2.3