gcc/testsuite/gcc.c-torture/execute/20020619-1.c
raw| 1 | void abort (void); |
| 2 | #if (__SIZEOF_INT__ == 4) |
| 3 | typedef int int32; |
| 4 | #elif (__SIZEOF_LONG__ == 4) |
| 5 | typedef long int32; |
| 6 | #else |
| 7 | #error Add target support for int32 |
| 8 | #endif |
| 9 | static int32 ref(void) |
| 10 | { |
| 11 | union { |
| 12 | char c[5]; |
| 13 | int32 i; |
| 14 | } u; |
| 15 | |
| 16 | __builtin_memset (&u, 0, sizeof(u)); |
| 17 | u.c[0] = 1; |
| 18 | u.c[1] = 2; |
| 19 | u.c[2] = 3; |
| 20 | u.c[3] = 4; |
| 21 | |
| 22 | return u.i; |
| 23 | } |
| 24 | |
| 25 | int main() |
| 26 | { |
| 27 | int32 b = ref(); |
| 28 | if (b != 0x01020304 |
| 29 | && b != 0x04030201) |
| 30 | abort (); |
| 31 | return 0; |
| 32 | } |