diff options
author | David Malcolm <dmalcolm@redhat.com> | 2018-11-30 15:57:37 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2018-11-30 15:57:37 +0000 |
commit | ef33afebf3351fe9f5032ebb735f4ec988e29f06 (patch) | |
tree | 9f1d775b8b2b7f5c104ec695f1b0a8a79f772339 /libgfortran/runtime/backtrace.c | |
parent | 187b9e1dc53da0a7db345b3c39fce7941e15f0f1 (diff) | |
download | gcc-ef33afebf3351fe9f5032ebb735f4ec988e29f06.zip gcc-ef33afebf3351fe9f5032ebb735f4ec988e29f06.tar.gz gcc-ef33afebf3351fe9f5032ebb735f4ec988e29f06.tar.bz2 |
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
Diffstat (limited to 'libgfortran/runtime/backtrace.c')
0 files changed, 0 insertions, 0 deletions