icc doesn't like -fomit-frame-pointer without -O
[libfirm] / ir / be / test / llvm / PR491.c
1 #include <stdio.h>
2 #include <assert.h>
3
4 static int assert_fail(const char* s, unsigned l)
5 {
6     fprintf(stderr, "assertion failed in line %u: '%s'\n", l, s);
7     return 0;
8 }
9 #define ASSERT(expr)    ((expr) ? 1 : assert_fail(#expr,__LINE__))
10
11 int test(int r) {
12 #if !defined(__i386__)
13   #if !defined(BYTE_ORDER) || !defined(LITTLE_ENDIAN)
14      return r;
15   #else
16      if (BYTE_ORDER != LITTLE_ENDIAN) return r;
17   #endif
18 #endif
19
20     /* little endian */
21     union { long l; unsigned char c[sizeof(long)]; } u;
22     u.l = 0; u.c[0] = 0x80;
23     r &= ASSERT(u.l == 128);
24     u.l = 0; u.c[sizeof(long)-1] = 0x80;
25     r &= ASSERT(u.l < 0);
26     return r;
27 }
28
29 int main() {
30     assert(test(1) == 1);
31         return 0;
32 }