[Bug analyzer/93947] ICE: Segmentation fault (in symtab_node::ultimate_alias_target)

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 27 02:04:00 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93947

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>:

https://gcc.gnu.org/g:0ba70d1b5ae8df6406a880b2d23e4710b393e8c9

commit r10-6879-g0ba70d1b5ae8df6406a880b2d23e4710b393e8c9
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Wed Feb 26 09:43:57 2020 -0500

    analyzer: fix ICE on unreachable calls [PR 93947]

    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.


More information about the Gcc-bugs mailing list