gcc/testsuite/gcc.c-torture/execute/widechar-3.c
raw| 1 | extern void abort (void); |
| 2 | extern void exit (int); |
| 3 | |
| 4 | static int f(char *x) |
| 5 | { |
| 6 | return __builtin_strlen(x); |
| 7 | } |
| 8 | |
| 9 | int foo () |
| 10 | { |
| 11 | return f((char*)&L"abcdef"[0]); |
| 12 | } |
| 13 | |
| 14 | |
| 15 | int |
| 16 | main() |
| 17 | { |
| 18 | #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ |
| 19 | if (foo () != 0) |
| 20 | abort (); |
| 21 | #elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
| 22 | if (foo () != 1) |
| 23 | abort (); |
| 24 | #endif |
| 25 | exit (0); |
| 26 | } |