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

--- Comment #4 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:5ee4ba031dd9fc60bf2494ca30f46c0acaa34805

commit r11-7333-g5ee4ba031dd9fc60bf2494ca30f46c0acaa34805
Author: David Malcolm <dmalc...@redhat.com>
Date:   Mon Feb 22 18:46:05 2021 -0500

    analyzer: handle error/error_at_line [PR99196]

    PR analyzer/99196 describes a false positive from -fanalyzer due to
    the analyzer not "knowing" that calls to GNU libc's error(3) with a
    nonzero status terminate the process and thus don't return.

    This patch fixes the false positive by special-casing "error" and
    "error_at_line".

    gcc/analyzer/ChangeLog:
            PR analyzer/99196
            * engine.cc (exploded_node::on_stmt): Provide terminate_path
            flag as a way for on_call_pre to terminate the current analysis
            path.
            * region-model-impl-calls.cc (call_details::num_args): New.
            (region_model::impl_call_error): New.
            * region-model.cc (region_model::on_call_pre): Add param
            "out_terminate_path".  Handle "error" and "error_at_line".
            * region-model.h (call_details::num_args): New decl.
            (region_model::on_call_pre): Add param "out_terminate_path".
            (region_model::impl_call_error): New decl.

    gcc/testsuite/ChangeLog:
            PR analyzer/99196
            * gcc.dg/analyzer/error-1.c: New test.
            * gcc.dg/analyzer/error-2.c: New test.
            * gcc.dg/analyzer/error-3.c: New test.

Reply via email to