1 /* { dg-do run }  */
2 /* { dg-require-effective-target int32plus } */
3 /* We use -ftrapv so that when SCEV final value replacement introduces
4    undefined overflow we trap.  UBSAN inhibits final value replacement.  */
5 /* { dg-additional-options "-ftrapv" } */
6 
7 int __attribute__((noclone,noinline))
foo(int a,int b)8 foo(int a, int b)
9 {
10   int sum = 0;
11   for (int i = 0; i < 60000; i++)
12     sum += a + i * b;
13   return sum;
14 }
15 
main(int argc,char ** argv)16 int main(int argc, char **argv)
17 {
18   if (foo (-30000, 2) != 1799940000)
19     __builtin_abort ();
20   return 0;
21 }
22