Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/gcc.dg/fwrapv-2.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
rev | line source |
---|---|
111 | 1 /* Copyright (C) 2003 Free Software Foundation. |
2 | |
3 Test that the -fno-wrapv command line option is accepted and enables | |
4 "unsafe" optimizations that rely on undefined arithmetic overflow. | |
5 | |
6 Written by Roger Sayle, 31st May 2003. */ | |
7 | |
8 /* { dg-do run } */ | |
9 /* { dg-options "-O2 -fno-wrapv" } */ | |
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 int | |
21 main() | |
22 { | |
23 int x = INT_MAX; | |
24 | |
25 if (test(x) != x) | |
26 abort (); | |
27 return 0; | |
28 } | |
29 |