aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr79721.c
blob: 97d20ca97a8a1b06ce02f8ca8474064be5b18bd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* { dg-do run }  */
/* { dg-require-effective-target int32plus } */
/* We use -ftrapv so that when SCEV final value replacement introduces
   undefined overflow we trap.  UBSAN inhibits final value replacement.  */
/* { dg-additional-options "-ftrapv" } */

int __attribute__((noclone,noinline))
foo(int a, int b)
{
  int sum = 0;
  for (int i = 0; i < 60000; i++)
    sum += a + i * b;
  return sum;
}

int main(int argc, char **argv)
{
  if (foo (-30000, 2) != 1799940000)
    __builtin_abort ();
  return 0;
}