Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.dg / torture / pr55633.c
1 /* PR fortran/55633 */
2 /* { dg-do run { target int128 } } */
3
4 extern void abort (void);
5
6 __attribute__((noinline, noclone)) void
7 bar (__int128_t *x)
8 {
9   int c = sizeof (__int128_t) * __CHAR_BIT__;
10   if (c > 127)
11     c = 127;
12   if (*x != c)
13     abort ();
14 }
15
16 __attribute__((noinline)) void
17 foo (void)
18 {
19   __int128_t m, ma;
20   ma = 0;
21   m = 0;
22   m = ~m;
23   do
24     {
25       if (m == 0 || ma > 126)
26         break;
27       ma = ma + 1;
28       m = ((__uint128_t) m) >> 1;
29     }
30   while (1);
31   bar (&ma);
32 }
33
34 int
35 main ()
36 {
37   foo ();
38   return 0;
39 }