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/105860] [10/11/12/13 Regression] Miscompilation causing clobbered union contents since r10-918-gc56c86024f8fba0c
Date: Mon, 11 Jul 2022 16:47:40 +0000	[thread overview]
Message-ID: <bug-105860-4-EUYy9vwn4Z@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105860-4@http.gcc.gnu.org/bugzilla/>

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

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

https://gcc.gnu.org/g:1a78fffb3845f879e36ba33b4d15e75b3df8d5a7

commit r12-8564-g1a78fffb3845f879e36ba33b4d15e75b3df8d5a7
Author: Martin Jambor <mjambor@suse.cz>
Date:   Mon Jul 11 18:43:23 2022 +0200

    tree-sra: Fix union handling in build_reconstructed_reference

    As the testcase in PR 105860 shows, the code that tries to re-use the
    handled_component chains in SRA can be horribly confused by unions,
    where it thinks it has found a compatible structure under which it can
    chain the references, but in fact it found the type it was looking
    for elsewhere in a union and generated a write to a completely wrong
    part of an aggregate.

    I don't remember whether the plan was to support unions at all in
    build_reconstructed_reference but it can work, to an extent, if we
    make sure that we start the search only outside the outermost union,
    which is what the patch does (and the extra testcase verifies).

    Additionally, this commit also contains sqashed in it a backport of
    b984b84cbe4bf026edef2ba37685f3958a1dc1cf which fixes the testcase
    gcc.dg/tree-ssa/alias-access-path-13.c for many 32-bit targets.

    gcc/ChangeLog:

    2022-07-01  Martin Jambor  <mjambor@suse.cz>

            PR tree-optimization/105860
            * tree-sra.cc (build_reconstructed_reference): Start expr
            traversal only just below the outermost union.

    gcc/testsuite/ChangeLog:

    2022-07-01  Martin Jambor  <mjambor@suse.cz>

            PR tree-optimization/105860
            * gcc.dg/tree-ssa/alias-access-path-13.c: New test.
            * gcc.dg/tree-ssa/pr105860.c: Likewise.

    (cherry picked from commit b110e5283e368b5377e04766e4ff82cd52634208)

  parent reply	other threads:[~2022-07-11 16:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-06 12:51 [Bug analyzer/105860] New: Miscompilation causing clobbered union contents tpg+gcc at mutabah dot net
2022-06-15 11:43 ` [Bug middle-end/105860] " marxin at gcc dot gnu.org
2022-06-15 12:05 ` tpg+gcc at mutabah dot net
2022-06-15 12:50 ` [Bug middle-end/105860] [10/11/12/13 Regression] Miscompilation causing clobbered union contents since r10-918-gc56c86024f8fba0c marxin at gcc dot gnu.org
2022-06-15 23:20 ` pinskia at gcc dot gnu.org
2022-06-28 10:49 ` jakub at gcc dot gnu.org
2022-07-01 18:12 ` jamborm at gcc dot gnu.org
2022-07-01 20:49 ` [Bug tree-optimization/105860] " jamborm at gcc dot gnu.org
2022-07-04 15:08 ` cvs-commit at gcc dot gnu.org
2022-07-11 16:47 ` cvs-commit at gcc dot gnu.org [this message]
2022-07-12 11:18 ` cvs-commit at gcc dot gnu.org
2022-07-13 11:19 ` cvs-commit at gcc dot gnu.org
2022-07-13 11:19 ` 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-105860-4-EUYy9vwn4Z@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).