struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-2855.c
bloba73d4e8846bd991290822baacd30e36b35f575fe
1 /*
2 bug-2855.c
4 Missing non-inline definition of aligned_alloc
5 */
7 #include <testfwk.h>
9 #include <stdlib.h>
11 #if __STDC_VERSION__ >= 201112L
12 #if !defined(__APPLE__)
13 #if !defined(__SDCC_hc08) && !defined(__SDCC_s08) && !defined(__SDCC_mcs51) && !defined(__SDCC_ds390) && !defined(__SDCC_pdk13) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) && !defined (__SDCC_mos6502) && !defined(__SDCC_mos65c02) || defined (__SDCC_STACK_AUTO) // Reentrancy required for function pointers.
14 void *(*volatile f)(size_t, size_t) = &aligned_alloc;
15 #endif
16 #endif
17 #endif
19 void testBug(void)
21 #if __STDC_VERSION__ >= 201112L
22 #if !defined(__APPLE__)
23 #if !defined(__SDCC_hc08) && !defined(__SDCC_s08) && !defined(__SDCC_mcs51) && !defined(__SDCC_ds390) && !defined(__SDCC_pdk13) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) && !defined (__SDCC_mos6502) && !defined(__SDCC_mos65c02) || defined (__SDCC_STACK_AUTO)
24 int *buffer = (*f)(_Alignof(int), sizeof(int) * 2);
25 buffer[0] = 23;
26 buffer[1] = 42;
27 ASSERT (buffer[0] == 23);
28 ASSERT (buffer[1] == 42);
29 free (buffer);
30 #endif
31 #endif
32 #endif