1 /* { dg-do run } */
2 /* { dg-options "-std=c99" } */
3 #include <stdlib.h>
4 typedef int TItype __attribute__ ((mode (TI)));
5 typedef int DItype __attribute__ ((mode (DI)));
6 typedef unsigned int UDItype __attribute__ ((mode (DI)));
7 
8 struct DIstruct {DItype high, low;};
9 typedef union
10 {
11   struct DIstruct s;
12   TItype t;
13 } TIunion;
14 
15 static
sub_ddmmss(UDItype * sh,UDItype * sl,UDItype ah,UDItype al,UDItype bh,UDItype bl)16 void sub_ddmmss (UDItype *sh, UDItype *sl, UDItype ah, UDItype al, UDItype bh, UDItype bl)
17 {
18   UDItype x;
19   x = al - bl;
20   *sh = ah - bh - (x > al);
21   *sl = x;
22 }
23 
main(void)24 int main(void)
25 {
26   TIunion aa, bb, cc;
27   TItype m = 0x1111111111111110ULL;
28   TItype n = 0x1111111111111111ULL;
29   TItype d;
30 
31   aa.s.high = m;
32   aa.s.low = m;
33   bb.s.high = n;
34   bb.s.low = n;
35 
36 
37   sub_ddmmss (&cc.s.high, &cc.s.low, aa.s.high, aa.s.low, bb.s.high, bb.s.low);
38   d = aa.t - bb.t;
39   if (d != cc.t)
40    abort();
41   cc.t = aa.t -d;
42   if (cc.t != bb.t)
43    abort();
44  return 0;
45 }
46