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