| 1 |
/* Verify that we consider various paths to be impossible, |
| 2 |
using functions to thwart early optimizations. */ |
| 3 |
|
| 4 |
#include "analyzer-decls.h" |
| 5 |
|
| 6 |
void test_1 (int idx) |
| 7 |
{ |
| 8 |
if (idx > 0) |
| 9 |
if (idx - 1 < 0) |
| 10 |
__analyzer_dump_path (); /* { dg-bogus "" } */ |
| 11 |
} |
| 12 |
|
| 13 |
static int called_by_test_1a (int idx) |
| 14 |
{ |
| 15 |
return idx - 1; |
| 16 |
} |
| 17 |
|
| 18 |
void test_1a (int idx) |
| 19 |
{ |
| 20 |
if (idx > 0) |
| 21 |
if (called_by_test_1a (idx) < 0) |
| 22 |
__analyzer_dump_path (); /* { dg-bogus "" } */ |
| 23 |
} |
| 24 |
|
| 25 |
void test_2 (int idx) |
| 26 |
{ |
| 27 |
if (idx + 1 > 0) |
| 28 |
if (idx < 0) |
| 29 |
__analyzer_dump_path (); /* { dg-bogus "" } */ |
| 30 |
} |
| 31 |
|
| 32 |
static int called_by_test_2a (int idx) |
| 33 |
{ |
| 34 |
return idx + 1; |
| 35 |
} |
| 36 |
|
| 37 |
void test_2a (int idx) |
| 38 |
{ |
| 39 |
if (called_by_test_2a (idx) > 0) |
| 40 |
if (idx < 0) |
| 41 |
__analyzer_dump_path (); /* { dg-bogus "" } */ |
| 42 |
} |