Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.dg / pr45415.c
blob9574b3a05d86273dd9f73a3d9c77c43e20f2e996
1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fno-tree-dominator-opts" } */
4 typedef unsigned long int st;
5 typedef unsigned long long dt;
6 typedef union
8 dt d;
9 struct
11 st h, l;
14 } t_be;
16 typedef union
18 dt d;
19 struct
21 st l, h;
24 } t_le;
26 #define df(f, t) \
27 int \
28 f (t afh, t bfh) \
29 { \
30 t hh; \
31 t hp, lp, dp, m; \
32 st ad, bd; \
33 int s; \
34 s = 0; \
35 ad = afh.s.h - afh.s.l; \
36 bd = bfh.s.l - bfh.s.h; \
37 if (bd > bfh.s.l) \
38 { \
39 bd = -bd; \
40 s = ~s; \
41 } \
42 lp.d = (dt) afh.s.l * bfh.s.l; \
43 hp.d = (dt) afh.s.h * bfh.s.h; \
44 dp.d = (dt) ad *bd; \
45 dp.d ^= s; \
46 hh.d = hp.d + hp.s.h + lp.s.h + dp.s.h; \
47 m.d = (dt) lp.s.h + hp.s.l + lp.s.l + dp.s.l; \
48 return hh.s.l + m.s.l; \
51 df(f_le, t_le)
52 df(f_be, t_be)
54 void abort (void);
55 void exit (int);
56 int
57 main ()
59 t_be x;
60 x.s.h = 0x10000000U;
61 x.s.l = 0xe0000000U;
62 if (x.d == 0x10000000e0000000ULL
63 && f_be ((t_be) 0x100000000ULL, (t_be) 0x100000000ULL) != -1)
64 abort ();
65 if (x.d == 0xe000000010000000ULL
66 && f_le ((t_le) 0x100000000ULL, (t_le) 0x100000000ULL) != -1)
67 abort ();
68 exit (0);