gcc/testsuite/c-c++-common/analyzer/feasibility-2.c
raw| 1 | /* Verify that -fno-analyzer-feasibility works. */ |
| 2 | /* { dg-additional-options "-fno-analyzer-feasibility" } */ |
| 3 | |
| 4 | #include "analyzer-decls.h" |
| 5 | |
| 6 | void test_1 (int flag) |
| 7 | { |
| 8 | int a; |
| 9 | if (flag) |
| 10 | a = 1; |
| 11 | else |
| 12 | a = 2; |
| 13 | |
| 14 | if (a == 1) /* (can only be the case when "flag" was true above). */ |
| 15 | if (!flag) |
| 16 | { |
| 17 | __analyzer_dump_path (); /* { dg-message "note: path" "path diag" } */ |
| 18 | /* { dg-message "infeasible" "infeasibility event" { target *-*-* } .-1 } */ |
| 19 | } |
| 20 | } |