re PR tree-optimization/33291 (a+=2; a+=2 not simplified to a+=4; with -O3 ...
[gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr21582.c
1 /* { dg-do link } */
2 /* { dg-options "-O2 -fdump-tree-vrp1" } */
3
4 static inline void do_thing(char *s, int *p, char *q)
5 {
6 /* This should be folded away. */
7 if (s == 0 || q == 0)
8 link_error ();
9
10 /* This should not be folded as 'p' is not marked nonnull. */
11 if (p)
12 *p = 3;
13 }
14
15 void __attribute__((nonnull (1, 3))) do_other_thing(char *s, int *p, char *q)
16 {
17 do_thing(s, p, q);
18 }
19
20 int i;
21
22 main()
23 {
24 do_other_thing ("xxx", &i, "yyy");
25 }
26
27 /* { dg-final { scan-tree-dump-times "Folding predicate p_.*" 0 "vrp1" } } */
28 /* { dg-final { cleanup-tree-dump "vrp1" } } */