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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Sebor <mse...@gcc.gnu.org>:

https://gcc.gnu.org/g:820f0940d7ace1306430a9dcf1bd9577508a7a7e

commit r12-3124-g820f0940d7ace1306430a9dcf1bd9577508a7a7e
Author: Martin Sebor <mse...@redhat.com>
Date:   Tue Aug 24 10:49:11 2021 -0600

    Reset PHI base0 flag if it's clear in any argument [PR101977, ...]

    Resolves:
    PR middle-end/101600 - Spurious -Warray-bounds downcasting a polymorphic
pointer
    PR middle-end/101977 - bogus -Warray-bounds on a negative index into a
parameter in conditional with null

    gcc/ChangeLog:

            PR middle-end/101600
            PR middle-end/101977
            * gimple-ssa-warn-access.cc (maybe_warn_for_bound): Tighten up
            the phrasing of a warning.
            (check_access): Use the remaining size after subtracting any offset
            rather than the whole object size.
            * pointer-query.cc (access_ref::get_ref): Clear BASE0 flag if it's
            clear for any nonnull PHI argument.
            (compute_objsize): Clear argument.

    gcc/testsuite/ChangeLog:

            PR middle-end/101600
            PR middle-end/101977
            * g++.dg/pr100574.C: Prune out valid warning.
            * gcc.dg/pr20126.c: Same.
            * gcc.dg/Wstringop-overread.c: Adjust text of expected warnings.
            Add new instances.
            * gcc.dg/warn-strnlen-no-nul.c: Same.
            * g++.dg/warn/Warray-bounds-26.C: New test.
            * gcc.dg/Warray-bounds-88.c: New test.

Reply via email to