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 tree-optimization/96820] ICE in verify_sra_access_forest with array and out of bounds reference
Date: Fri, 04 Sep 2020 12:32:12 +0000	[thread overview]
Message-ID: <bug-96820-4-2cIOaHC8o0@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96820-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Martin Jambor
<jamborm@gcc.gnu.org>:

https://gcc.gnu.org/g:75f5776b3fc4dad7453f8b9cf1690bd2ad628991

commit r10-8709-g75f5776b3fc4dad7453f8b9cf1690bd2ad628991
Author: Martin Jambor <mjambor@suse.cz>
Date:   Fri Sep 4 14:31:16 2020 +0200

    sra: Avoid SRAing if there is an aout-of-bounds access (PR 96820)

    The testcase causes and ICE in the SRA verifier on x86_64 when
    compiling with -m32 because build_user_friendly_ref_for_offset looks
    at an out-of-bounds array_ref within an array_ref which accesses an
    offset which does not fit into a signed 32bit integer and turns it
    into an array-ref with a negative index.

    The best thing is probably to bail out early when encountering an out
    of bounds access to a local stack-allocated aggregate (and let the DSE
    just delete such statements) which is what the patch does.

    I also glanced over to the initial candidate vetting routine to make
    sure the size would fit into HWI and noticed that it uses unsigned
    variants whereas the rest of SRA operates on signed offsets and
    sizes (because get_ref_and_extent does) and so changed that for the
    sake of consistency.  These ancient checks operate on sizes of types
    as opposed to DECLs but I hope that any issues potentially arising
    from that are basically hypothetical.

    gcc/ChangeLog:

    2020-08-28  Martin Jambor  <mjambor@suse.cz>

            PR tree-optimization/96820
            * tree-sra.c (create_access): Disqualify candidates with accesses
            beyond the end of the original aggregate.
            (maybe_add_sra_candidate): Check that candidate type size fits
            signed uhwi for the sake of consistency.

    gcc/testsuite/ChangeLog:

    2020-08-28  Martin Jambor  <mjambor@suse.cz>

            PR tree-optimization/96820
            * gcc.dg/tree-ssa/pr96820.c: New test.

    (cherry picked from commit 8ad3fc6ca46c603d9c3efe8e6d4a8f2ff1a893a4)

  parent reply	other threads:[~2020-09-04 12:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-27 15:28 [Bug tree-optimization/96820] New: ICE on x86_64-linux-gnu with `-m32` and from `-O0` to `-O3` (internal compiler error: in verify_sra_access_forest, at tree-sra.c:2358) cnsun at uwaterloo dot ca
2020-08-27 15:33 ` [Bug tree-optimization/96820] " cnsun at uwaterloo dot ca
2020-08-28  6:16 ` rguenth at gcc dot gnu.org
2020-08-28  7:26 ` marxin at gcc dot gnu.org
2020-08-28  7:33 ` marxin at gcc dot gnu.org
2020-08-28 10:27 ` jamborm at gcc dot gnu.org
2020-08-30 14:31 ` [Bug tree-optimization/96820] ICE in verify_sra_access_forest with array and out of bounds reference jamborm at gcc dot gnu.org
2020-09-03 20:51 ` cvs-commit at gcc dot gnu.org
2020-09-04 12:32 ` cvs-commit at gcc dot gnu.org [this message]
2020-09-04 12:32 ` jamborm 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-96820-4-2cIOaHC8o0@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).