modula2 testsuite: new libc unit test
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 991228-1.c
blobd84c1cfc16de3e50f14636c0bc91887f4c0f41d9
1 void abort (void);
2 void exit (int);
4 __extension__ union { double d; int i[2]; } u = { d: -0.25 };
6 /* This assumes the endianness of words in a long long is the same as
7 that for doubles, which doesn't hold for a few platforms, but we
8 can probably special case them here, as appropriate. */
9 long long endianness_test = 1;
10 #define MSW (*(int*)&endianness_test)
12 int
13 signbit(double x)
15 __extension__ union { double d; int i[2]; } u = { d: x };
16 return u.i[MSW] < 0;
19 int main(void)
21 if (2*sizeof(int) != sizeof(double) || u.i[MSW] >= 0)
22 exit(0);
24 if (!signbit(-0.25))
25 abort();
27 exit(0);