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

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

https://gcc.gnu.org/g:5eae0ac76dcb6aac1d1d6c4edd8852e0035792e4

commit r10-8015-g5eae0ac76dcb6aac1d1d6c4edd8852e0035792e4
Author: David Malcolm <dmalc...@redhat.com>
Date:   Tue Apr 28 10:52:45 2020 -0400

    analyzer: fix ICE copying struct [PR 94816]

    PR analyzer/94816 reports an ICE when attempting to copy a struct
    containing a field for which add_region_for_type for fails (on
    an OFFSET_TYPE): the region for the src field comes from
    make_region_for_unexpected_tree_code which gives it a NULL type, and
    then the copy calls add_region_for_type which unconditionally
    dereferences the NULL type.

    This patch fixes the ICE by checking for NULL types in
    add_region_for_type.

    gcc/analyzer/ChangeLog:
            PR analyzer/94816
            * engine.cc (impl_region_model_context::on_unexpected_tree_code):
            Handle NULL tree.
            * region-model.cc (region_model::add_region_for_type): Handle
            NULL type.
            * region-model.h
            (test_region_model_context::on_unexpected_tree_code): Handle NULL
            tree.

    gcc/testsuite/ChangeLog:
            PR analyzer/94816
            * g++.dg/analyzer/pr94816.C: New test.

Reply via email to