| 1 |
/* { dg-additional-options "-fanalyzer-call-summaries --param analyzer-min-snodes-for-call-summary=0 -fno-analyzer-state-merge" } */ |
| 2 |
|
| 3 |
/* There need to be at least two calls to a function for the |
| 4 |
call-summarization code to be used. |
| 5 |
TODO: add some kind of test that summarization *was* used. */ |
| 6 |
|
| 7 |
#include "analyzer-decls.h" |
| 8 |
|
| 9 |
/* With state merging disabled, we get two summaries here. */ |
| 10 |
|
| 11 |
int two_outcomes (int flag, int x, int y) |
| 12 |
{ |
| 13 |
if (flag) |
| 14 |
return x; |
| 15 |
else |
| 16 |
return y; |
| 17 |
} |
| 18 |
|
| 19 |
void test_two_outcomes (int outer_flag, int a, int b) |
| 20 |
{ |
| 21 |
int r; |
| 22 |
__analyzer_eval (two_outcomes (1, a, b) == a); /* { dg-warning "TRUE" } */ |
| 23 |
__analyzer_eval (two_outcomes (0, a, b) == b); /* { dg-warning "TRUE" } */ |
| 24 |
r = two_outcomes (outer_flag, a, b); |
| 25 |
if (outer_flag) |
| 26 |
__analyzer_eval (r == a); /* { dg-warning "TRUE" } */ |
| 27 |
else |
| 28 |
__analyzer_eval (r == b); /* { dg-warning "TRUE" } */ |
| 29 |
} |