4d2ecd960a
The following patch fixes two bugs in the access_ref::inform_access function (plus some formatting nits). The first problem is that ref can be various things, e.g. *_DECL, or SSA_NAME, or IDENTIFIER_NODE. And allocfn is non-NULL only if ref is (at least originally) an SSA_NAME initialized to the result of some allocator function (but not e.g. __builtin_alloca_with_align which is handled differently). A few lines above the last hunk of this patch in builtins.c, the code uses if (mode == access_read_write || mode == access_write_only) { if (allocfn == NULL_TREE) { if (*offstr) inform (loc, "at offset %s into destination object %qE of size %s", offstr, ref, sizestr); else inform (loc, "destination object %qE of size %s", ref, sizestr); return; } if (*offstr) inform (loc, "at offset %s into destination object of size %s " "allocated by %qE", offstr, sizestr, allocfn); else inform (loc, "destination object of size %s allocated by %qE", sizestr, allocfn); return; } so if allocfn is NULL, it prints whatever ref is, if it is non-NULL, it prints instead the allocation function. But strangely the hunk a few lines below wasn't consistent with that and instead printed the first form only if DECL_P (ref) and would ICE if ref wasn't a decl but still allocfn was NULL. Fixed by making it consistent what the code does earlier. Another bug is that the code earlier contains an ugly hack for VLAs and was assuming that SSA_NAME_IDENTIFIER must be non-NULL on the lhs of __builtin_alloca_with_align. While that is likely true for the cases where the compiler emits this builtin for VLAs (and it will also be true that the name of the VLA in that case can be taken from that identifier up to the first .), the builtin is user accessible as the testcase shows, so one can have any other SSA_NAME in there. I think it would be better to add some more reliable way how to identify VLA names corresponding to __builtin_alloca_with_align allocations, perhaps internal fn or whatever, but that is beyond the scope of this patch. 2021-01-20 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/98721 * builtins.c (access_ref::inform_access): Don't assume SSA_NAME_IDENTIFIER must be non-NULL. Print messages about object whenever allocfn is NULL, rather than only when DECL_P is true. Use %qE instead of %qD for that. Formatting fixes. * gcc.dg/pr98721-1.c: New test. * gcc.dg/pr98721-2.c: New test. |
||
---|---|---|
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
intl | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgo | ||
libgomp | ||
libhsail-rt | ||
libiberty | ||
libitm | ||
libobjc | ||
liboffloadmic | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
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 | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
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.