PR analyzer/93947 reports an ICE at -O1 when attempting to analyze a call that has been optimized away as unreachable. The root cause is a NULL dereference due to the fndecl having a NULL cgraph_node: the cgraph_node was created by pass_build_cgraph_edges::execute, but was later removed by symbol_table::remove_unreachable_nodes before the analyzer pass. This patch fixes it by checking for NULL before handling the cgraph_node. The reproducer demonstrates a weakness in the analyzer's constraint handling, where region_model::apply_constraints_for_gswitch fails to spot when the cases fully cover the data type, and thus make the default impossible. For now this is xfail-ed in the testcase. gcc/analyzer/ChangeLog: PR analyzer/93947 * region-model.cc (region_model::get_fndecl_for_call): Gracefully fail for fn_decls that don't have a cgraph_node. gcc/testsuite/ChangeLog: PR analyzer/93947 * gcc.dg/analyzer/torture/pr93947.c: New test.
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| 20060625-1.c | Loading commit data... | |
| analyzer-torture.exp | Loading commit data... | |
| conditionals-2.c | Loading commit data... | |
| conftest-1.c | Loading commit data... | |
| intptr_t.c | Loading commit data... | |
| poc.c | Loading commit data... | |
| pr51628-30.c | Loading commit data... | |
| pr59037.c | Loading commit data... | |
| pr93349.c | Loading commit data... | |
| pr93350.c | Loading commit data... | |
| pr93356.c | Loading commit data... | |
| pr93373.c | Loading commit data... | |
| pr93374.c | Loading commit data... | |
| pr93379-2.c | Loading commit data... | |
| pr93379.c | Loading commit data... | |
| pr93438-2.c | Loading commit data... | |
| pr93438.c | Loading commit data... | |
| pr93450.c | Loading commit data... | |
| pr93451.c | Loading commit data... | |
| pr93544.c | Loading commit data... | |
| pr93647.c | Loading commit data... | |
| pr93649.c | Loading commit data... | |
| pr93947.c | Loading commit data... |