summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr55633.c
blob: 5d30d61a61bd7f760427cd5e579521a1ca01aa23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* PR fortran/55633 */
/* { dg-do run { target int128 } } */

extern void abort (void);

__attribute__((noinline, noclone)) void
bar (__int128_t *x)
{
  int c = sizeof (__int128_t) * __CHAR_BIT__;
  if (c > 127)
    c = 127;
  if (*x != c)
    abort ();
}

__attribute__((noinline)) void
foo (void)
{
  __int128_t m, ma;
  ma = 0;
  m = 0;
  m = ~m;
  do
    {
      if (m == 0 || ma > 126)
	break;
      ma = ma + 1;
      m = ((__uint128_t) m) >> 1;
    }
  while (1);
  bar (&ma);
}

int
main ()
{
  foo ();
  return 0;
}