[Bug tree-optimization/119085] [13/14 regression] tree-sra generates wrong code for unions containing structs with holes (Emacs crashes with -O3) since r10-6321-g636e80eea24b78

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Aug 20 11:34:34 GMT 2025


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

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

https://gcc.gnu.org/g:dabac057141c26a69325a410c81de0ff2157c6c9

commit r14-11971-gdabac057141c26a69325a410c81de0ff2157c6c9
Author: Martin Jambor <mjambor@suse.cz>
Date:   Wed Jul 23 11:22:33 2025 +0200

    tree-sra: Avoid total SRA if there are incompat. aggregate accesses 
(PR119085)

    We currently use the types encountered in the function body and not in
    type declaration to perform total scalarization.  Bug PR 119085
    uncovered that we miss a check that when the same data is accessed
    with aggregate types that those are actually compatible.  Without it,
    we can base total scalarization on a type that does not "cover" all
    live data in a different part of the function.  This patch adds the
    check.

    gcc/ChangeLog:

    2025-07-21  Martin Jambor  <mjambor@suse.cz>

            PR tree-optimization/119085
            * tree-sra.cc (sort_and_splice_var_accesses): Prevent total
            scalarization if two incompatible aggregates access the same place.

    gcc/testsuite/ChangeLog:

    2025-07-21  Martin Jambor  <mjambor@suse.cz>

            PR tree-optimization/119085
            * gcc.dg/tree-ssa/pr119085.c: New test.

    (cherry picked from commit 171fcc80ede596442712e559c4fc787aa4636694)


More information about the Gcc-bugs mailing list