1 /* Copyright (C) 2003 Free Software Foundation.
2 
3    Test that the -fwrapv command line option is accepted and disables
4    "unsafe" optimizations that rely on undefined arithmetic overflow.
5 
6    Written by Roger Sayle, 24th March 2003.  */
7 
8 /* { dg-do run } */
9 /* { dg-options "-O2 -fwrapv" } */
10 
11 #include <limits.h>
12 
13 extern void abort ();
14 
test(int x)15 int test(int x)
16 {
17   return (2*x)/2;
18 }
19 
main()20 main()
21 {
22   int x = INT_MAX;
23 
24   if (test(x) == x)
25     abort ();
26   return 0;
27 }
28 
29