Go to file
David Malcolm ef33afebf3 Fix ICE in substring locations from macros in header files (PR preprocessor/88257)
PR preprocessor/88257 reports an ICE on gcc.dg/format/pr78304.c
when compiled using g++:

void test (const char *msg)
{
  printf ("size: %" PRIu32 "\n", msg);
}

due to mismatching files (and line maps) between
linemap_resolve_location and expand_location_to_spelling_point
when PRIu32 is defined in a system header.

The root cause is that expand_location_to_spelling_point stops
unwinding locations when it reaches a system header, whereas
linemap_resolve_location can resolve into a system header,
which can lead to locations within get_substring_ranges_for_loc
getting out of sync, and using the wrong line map.

This patch fixes the issue by checking that the files are the
same.

gcc/ChangeLog:
	PR preprocessor/88257
	* input.c (get_substring_ranges_for_loc): Fix indentation.
	Bulletproof against getting a different files back from
	linemap_resolve_location and expand_location_to_spelling_point.

gcc/testsuite/ChangeLog:
	PR preprocessor/88257
	* c-c++-common/Wformat-pr88257.c: New test.
	* c-c++-common/Wformat-pr88257.h: New test header.
	* c-c++-common/empty.h: New test header.

From-SVN: r266671
2018-11-30 15:57:37 +00:00
config
contrib
fixincludes
gcc Fix ICE in substring locations from macros in header files (PR preprocessor/88257) 2018-11-30 15:57:37 +00:00
gnattools
gotools
include
INSTALL
intl
libada
libatomic
libbacktrace [libbacktrace] Add tests for unused formats 2018-11-30 15:33:23 +00:00
libcc1
libcpp
libdecnumber
libffi
libgcc
libgfortran
libgo
libgomp
libhsail-rt
libiberty
libitm
libobjc
liboffloadmic
libphobos libphobos: Merge common version blocks using arch_any conditions 2018-11-28 21:53:06 +00:00
libquadmath
libsanitizer
libssp
libstdc++-v3 Only include bits/stl_algo.h for C++20. 2018-11-29 15:17:17 +00:00
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.