7fc53ba4f8
Most GCC ranges seem to be represented as an offset and a size (rather than a start and inclusive end or start and exclusive end). The usual test for whether X is in a range is of course: x >= start && x < start + size or: x >= start && x - start < size which means that an empty range of size 0 contains nothing. But other range tests aren't as obvious. The usual test for whether one range is contained within another range is: start1 >= start2 && start1 + size1 <= start2 + size2 while the test for whether two ranges overlap (from ranges_overlap_p) is: (start1 >= start2 && start1 < start2 + size2) || (start2 >= start1 && start2 < start1 + size1) i.e. the ranges overlap if one range contains the start of the other range. This leads to strange results like: (start X, size 0) is a subrange of (start X, size 0) but (start X, size 0) does not overlap (start X, size 0) Similarly: (start 4, size 0) is a subrange of (start 2, size 2) but (start 4, size 0) does not overlap (start 2, size 2) It seems like "X is a subrange of Y" should imply "X overlaps Y". This becomes harder to ignore with the runtime sizes and offsets added for SVE. The most obvious fix seemed to be to say that an empty range does not overlap anything, and is therefore not a subrange of anything. Using the new definition of subranges didn't seem to cause any codegen differences in the testsuite. But there was one change with the new definition of overlapping ranges. strncpy-chk.c has: memset (dst, 0, sizeof (dst)); if (strncpy (dst, src, 0) != dst || strcmp (dst, "")) abort(); The strncpy is detected as a zero-size write, and so with the new definition of overlapping ranges, we treat the strncpy as having no effect on the strcmp (which is true). The reaching definition is the memset instead. This patch makes ranges_overlap_p return false for zero-sized ranges, even if the other range has an unknown size. 2017-11-01 Richard Sandiford <richard.sandiford@linaro.org> gcc/ * tree-ssa-alias.h (ranges_overlap_p): Return false if either range is known to be empty. From-SVN: r254312 |
||
---|---|---|
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
intl | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcilkrts | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgo | ||
libgomp | ||
libhsail-rt | ||
libiberty | ||
libitm | ||
libmpx | ||
libobjc | ||
liboffloadmic | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
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 | ||
README | ||
symlink-tree | ||
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.