OSDN Git Service

Call abort for runtime test, always return 0 from main.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / fwrapv-2.c
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 main()
21 {
22   int x = INT_MAX;
23
24   if (test(x) != x)
25     abort ();
26   return 0;
27 }
28