aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr112760.c
blob: b4ec70e470122d19b2488c8a6e4569c2655c0cc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* PR rtl-optimization/112760 */
/* { dg-do run } */
/* { dg-options "-O2 -fno-dce -fno-guess-branch-probability --param=max-cse-insns=0" } */
/* { dg-additional-options "-m8bit-idiv -mavx" { target i?86-*-* x86_64-*-* } } */

unsigned g;

__attribute__((__noipa__)) unsigned short
foo (unsigned short a, unsigned short b)
{
  unsigned short x = __builtin_add_overflow_p (a, g, (unsigned short) 0);
  g -= g / b;
  return x;
}

int
main ()
{
  unsigned short x = foo (40, 6);
  if (x != 0)
    __builtin_abort ();
}