aboutsummaryrefslogtreecommitdiff
path: root/libcpp/directives.c
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@redhat.com>2016-03-25 10:15:39 -0600
committerJeff Law <law@gcc.gnu.org>2016-03-25 10:15:39 -0600
commit3caf0ca1d3d1c6a65cd2437572992b9bc0a8d067 (patch)
tree9471bd17deccc2f59b0dbe6408240bdddda296b2 /libcpp/directives.c
parent634035b610977ac310cce45fe3b771ac2a3730d7 (diff)
downloadgcc-3caf0ca1d3d1c6a65cd2437572992b9bc0a8d067.zip
gcc-3caf0ca1d3d1c6a65cd2437572992b9bc0a8d067.tar.gz
gcc-3caf0ca1d3d1c6a65cd2437572992b9bc0a8d067.tar.bz2
re PR preprocessor/69650 (ICE in linemap_line_start, at libcpp/line-map.c:803)
PR lto/69650 * directives.c (do_linemarker): Test for file left but not entered here. * line-map.c (linemap_add): Not here. PR lto/69650 * gcc.dg/pr69650.c: New test. From-SVN: r234481
Diffstat (limited to 'libcpp/directives.c')
-rw-r--r--libcpp/directives.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libcpp/directives.c b/libcpp/directives.c
index 63f54ef..6aa6bd1 100644
--- a/libcpp/directives.c
+++ b/libcpp/directives.c
@@ -1046,6 +1046,19 @@ do_linemarker (cpp_reader *pfile)
skip_rest_of_line (pfile);
+ if (reason == LC_LEAVE)
+ {
+ const line_map_ordinary *from;
+ if (MAIN_FILE_P (map)
+ || (new_file
+ && (from = INCLUDED_FROM (pfile->line_table, map)) != NULL
+ && filename_cmp (ORDINARY_MAP_FILE_NAME (from), new_file) != 0))
+ {
+ cpp_warning (pfile, CPP_W_NONE,
+ "file \"%s\" linemarker ignored due to incorrect nesting", new_file);
+ return;
+ }
+ }
/* Compensate for the increment in linemap_add that occurs in
_cpp_do_file_change. We're currently at the start of the line
*following* the #line directive. A separate source_location for this