OSDN Git Service

2010-01-21 Martin Jambor <mjambor@suse.cz>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / pr22026.c
1 /* PR tree-optimization/22026
2    VRP used think that ~[0,0] + ~[0,0] = ~[0,0], which is wrong.  The
3    same applies to subtraction and unsigned multiplication.  */
4
5 /* { dg-do compile } */
6 /* { dg-options "-O2 -fdump-tree-vrp1" } */
7
8 int
9 plus (int x, int y)
10 {
11   if (x != 0)
12     if (y != 0)
13       {
14         int z = x + y;
15         if (z != 0)
16           return 1;
17       }
18   return 0;
19 }
20
21 int
22 minus (int x, int y)
23 {
24   if (x != 0)
25     if (y != 0)
26       {
27         int z = x - y;
28         if (z != 0)
29           return 1;
30       }
31   return 0;
32 }
33
34 int
35 mult (unsigned x, unsigned y)
36 {
37   if (x != 0)
38     if (y != 0)
39       {
40         unsigned z = x * y;
41         if (z != 0)
42           return 1;
43       }
44   return 0;
45 }
46
47 /* None of the predicates can be folded in these functions.  */
48 /* { dg-final { scan-tree-dump-times "Folding predicate" 0 "vrp1" } } */
49 /* { dg-final { cleanup-tree-dump "vrp1" } } */