Handle unsigned constants for module I/O.
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 960416-1.c
blobd877827edc3cc86de5a1f3fbf885fc69019546bf
1 void abort (void);
2 void exit (int);
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 int
55 main (void)
57 t_be x;
58 x.s.h = 0x10000000U;
59 x.s.l = 0xe0000000U;
60 if (x.d == 0x10000000e0000000ULL
61 && f_be ((t_be) 0x100000000ULL, (t_be) 0x100000000ULL) != -1)
62 abort ();
63 if (x.d == 0xe000000010000000ULL
64 && f_le ((t_le) 0x100000000ULL, (t_le) 0x100000000ULL) != -1)
65 abort ();
66 exit (0);