public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug analyzer/107882] [13 Regression] ICE in get_last_bit_offset, at analyzer/store.h:255 since 13-2582-g0ea5e3f4542832b8
Date: Tue, 06 Dec 2022 23:25:26 +0000	[thread overview]
Message-ID: <bug-107882-4-WdHAwfJEaK@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107882-4@http.gcc.gnu.org/bugzilla/>

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

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

commit r13-4529-gdfe2ef7f2b6cac7017f32a0a04f74e1b6d9f1311
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Tue Dec 6 18:24:16 2022 -0500

    analyzer: don't create bindings or binding keys for empty regions
[PR107882]

    PR analyzer/107882 reports an ICE, due to trying to get a compound svalue
    for this binding:

      cluster for: a:
        key:   {bytes 0-3}
        value:  {UNKNOWN()}
        key:   {empty}
        value:  {UNKNOWN()}
        key:   {bytes 4-7}
        value:  {UNKNOWN()}

    where there's an binding to the unknown value of zero bits in size
    "somewhere" within "a" (perhaps between bits 3 and 4?)

    This makes no sense, so this patch adds an assertion that we never
    attempt to create a binding key for an empty region, and adds early
    rejection of attempts to get or set the values of such regions, fixing
    the ICE.

    gcc/analyzer/ChangeLog:
            PR analyzer/107882
            * region-model.cc (region_model::get_store_value): Return an
            unknown value for empty regions.
            (region_model::set_value): Bail on empty regions.
            * region.cc (region::empty_p): New.
            * region.h (region::empty_p): New decl.
            * state-purge.cc (same_binding_p): Bail if either region is empty.
            * store.cc (binding_key::make): Assert that a concrete binding's
            bit_size must be > 0.
            (binding_cluster::mark_region_as_unknown): Bail on empty regions.
            (binding_cluster::get_binding): Likewise.
            (binding_cluster::remove_overlapping_bindings): Likewise.
            (binding_cluster::on_unknown_fncall): Don't conjure values for
            empty regions.
            (store::fill_region): Bail on empty regions.
            * store.h (class concrete_binding): Update comment to reflect that
            the range of bits must be non-empty.
            (concrete_binding::concrete_binding): Assert that bit range is
            non-empty.

    gcc/testsuite/ChangeLog:
            PR analyzer/107882
            * gcc.dg/analyzer/memcpy-pr107882.c: New test.

    Signed-off-by: David Malcolm <dmalcolm@redhat.com>

  parent reply	other threads:[~2022-12-06 23:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-26 19:36 [Bug analyzer/107882] New: [13 Regression] ICE in get_last_bit_offset, at analyzer/store.h:255 asolokha at gmx dot com
2022-11-28  6:49 ` [Bug analyzer/107882] " marxin at gcc dot gnu.org
2022-11-28  7:38 ` [Bug analyzer/107882] [13 Regression] ICE in get_last_bit_offset, at analyzer/store.h:255 since 13-2582-g0ea5e3f4542832b8 rguenth at gcc dot gnu.org
2022-11-28 19:47 ` tlange at gcc dot gnu.org
2022-12-06 20:53 ` dmalcolm at gcc dot gnu.org
2022-12-06 23:25 ` cvs-commit at gcc dot gnu.org [this message]
2022-12-06 23:33 ` dmalcolm at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-107882-4-WdHAwfJEaK@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).