]> gcc.gnu.org Git - gcc.git/blob - gcc/testsuite/gcc.dg/fwrapv-1.c
re PR c++/14267 (ICE on invalid, cast to lval related)
[gcc.git] / gcc / testsuite / gcc.dg / fwrapv-1.c
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
15 int test(int x)
16 {
17 return (2*x)/2;
18 }
19
20 main()
21 {
22 int x = INT_MAX;
23
24 if (test(x) == x)
25 abort ();
26 return 0;
27 }
28
This page took 0.04405 seconds and 5 git commands to generate.