1 /* PR tree-optimization/22117
2    VRP used think that &p[q] is nonzero even though p and q are both
3    known to be zero after entering the first two "if" statements.  */
4 
5 /* { dg-do compile } */
6 /* { dg-options "-O2 -fdump-tree-vrp1" } */
7 
8 void link_error (void);
9 
10 void
foo(int * p,int q)11 foo (int *p, int q)
12 {
13   if (p == 0)
14     {
15       if (q == 0)
16 	{
17 	  int *r = &p[q];
18 	  if (r != 0)
19 	    link_error ();
20 	}
21     }
22 }
23 
24 /* { dg-final { scan-tree-dump-times "link_error" 0 "vrp1" } } */
25