Go to file
Martin Jambor b110e5283e
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).

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.
2022-07-04 17:07:04 +02:00
c++tools Daily bump. 2022-03-19 00:16:22 +00:00
config Daily bump. 2022-06-02 00:16:32 +00:00
contrib gcc-descr: by default show revision for HEAD 2022-07-04 12:27:43 +02:00
fixincludes Daily bump. 2022-02-28 00:16:17 +00:00
gcc tree-sra: Fix union handling in build_reconstructed_reference 2022-07-04 17:07:04 +02:00
gnattools
gotools Daily bump. 2022-02-14 00:16:23 +00:00
include OpenMP: Move omp requires checks to libgomp 2022-07-04 13:52:02 +02:00
INSTALL
intl
libada
libatomic Daily bump. 2022-06-03 00:16:40 +00:00
libbacktrace Daily bump. 2022-06-28 00:16:58 +00:00
libcc1 Daily bump. 2022-06-28 00:16:58 +00:00
libcody Daily bump. 2022-06-04 00:16:27 +00:00
libcpp Daily bump. 2022-06-29 00:17:00 +00:00
libdecnumber Daily bump. 2022-05-21 00:16:32 +00:00
libffi
libgcc Daily bump. 2022-06-26 00:16:33 +00:00
libgfortran Daily bump. 2022-06-30 00:16:46 +00:00
libgo libgo: handle stat st_atim32 field and SYS_SECCOMP 2022-06-30 12:35:08 -07:00
libgomp OpenMP: Move omp requires checks to libgomp 2022-07-04 13:52:02 +02:00
libiberty Prevent another potential stack overflow issue when demangling a maliciouslt mangled Rust name. 2022-07-04 11:05:03 +01:00
libitm Daily bump. 2022-06-03 00:16:40 +00:00
libobjc
liboffloadmic OpenMP: Move omp requires checks to libgomp 2022-07-04 13:52:02 +02:00
libphobos Daily bump. 2022-06-30 00:16:46 +00:00
libquadmath
libsanitizer libsanitizer: cherry-pick 791e0d1bc85d 2022-06-29 15:28:07 +02:00
libssp
libstdc++-v3 Daily bump. 2022-07-02 00:16:26 +00:00
libvtv
lto-plugin Daily bump. 2022-07-02 00:16:26 +00:00
maintainer-scripts Daily bump. 2022-05-21 00:16:32 +00:00
zlib
.dir-locals.el
.gitattributes
.gitignore Vim swap files not ignored 2022-05-28 09:38:29 -06:00
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2022-07-04 00:16:19 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure [gdb/build] Fix gdbserver build with -fsanitize=thread 2022-06-27 10:52:23 +02:00
configure.ac [gdb/build] Fix gdbserver build with -fsanitize=thread 2022-06-27 10:52:23 +02:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS MAINTAINERS: fix alphabetic sorting 2022-07-04 12:16:32 +02:00
Makefile.def toplevel: Makefile.def: Make configure-sim depend on all-readline 2022-03-09 20:54:37 +01:00
Makefile.in Add TFLAGS to gcc's GCC_FOR_TARGET 2022-06-28 09:41:07 -03:00
Makefile.tpl Add TFLAGS to gcc's GCC_FOR_TARGET 2022-06-28 09:41:07 -03:00
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
symlink-tree
test-driver
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.