Skip analyzer strndup test on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / gcc.dg / signbit-6.c
blobda186624cfa057dfc3780c8af4f6b1335ba07e7e
1 /* { dg-do run } */
2 /* { dg-options "-O1" } */
4 #include <stdint.h>
5 #include <limits.h>
6 #include <stdio.h>
8 #ifndef N
9 #define N 65
10 #endif
12 #ifndef TYPE
13 #define TYPE int32_t
14 #endif
16 #ifndef DEBUG
17 #define DEBUG 1
18 #endif
20 #define BASE ((TYPE) -1 < 0 ? -126 : 4)
22 __attribute__ ((noinline, noipa))
23 void fun1(TYPE *x, int n)
25 for (int i = 0; i < n; i++)
26 x[i] = (-x[i]) >> 31;
29 __attribute__ ((noinline, noipa, optimize("O0")))
30 void fun2(TYPE *x, int n)
32 for (int i = 0; i < n; i++)
33 x[i] = (-x[i]) >> 31;
36 int main ()
38 TYPE a[N];
39 TYPE b[N];
41 a[0] = INT_MIN;
42 b[0] = INT_MIN;
44 for (int i = 1; i < N; ++i)
46 a[i] = BASE + i * 13;
47 b[i] = BASE + i * 13;
48 if (DEBUG)
49 printf ("%d: 0x%x\n", i, a[i]);
52 fun1 (a, N);
53 fun2 (b, N);
55 if (DEBUG)
56 printf ("%d = 0x%x == 0x%x\n", 0, a[0], b[0]);
58 if (a[0] != 0x0 || b[0] != -1)
59 __builtin_abort ();
62 for (int i = 1; i < N; ++i)
64 if (DEBUG)
65 printf ("%d = 0x%x == 0x%x\n", i, a[i], b[i]);
67 if (a[i] != b[i])
68 __builtin_abort ();
70 return 0;