re PR preprocessor/69650 (ICE in linemap_line_start, at libcpp/line-map.c:803)
authorBernd Schmidt <bernds@redhat.com>
Wed, 13 Apr 2016 11:40:37 +0000 (11:40 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Wed, 13 Apr 2016 11:40:37 +0000 (11:40 +0000)
Patch from Roger Orr <rogero@howzatt.demon.co.uk>
PR preprocessor/69650
* directives.c (do_linemarker): Reread map after calling
cpp_get_token.

From-SVN: r234932

libcpp/ChangeLog
libcpp/directives.c

index 583f9542eabd6916463ae1a6c2c488bf59a7c721..acb8d75dccfe5f79863b1657034da778714f5170 100644 (file)
@@ -1,3 +1,10 @@
+2016-04-13  Bernd Schmidt  <bschmidt@redhat.com>
+
+       Patch from Roger Orr <rogero@howzatt.demon.co.uk>
+       PR preprocessor/69650
+       * directives.c (do_linemarker): Reread map after calling
+       cpp_get_token.
+
 2016-04-06  Richard Henderson  <rth@redhat.com>
 
        PR preprocessor/61817
index 6aa6bd1f86acd17682cf581a431431cc7cc030ba..1617ff61c3c37257c396dec6c50f3a578c843310 100644 (file)
@@ -1048,6 +1048,9 @@ do_linemarker (cpp_reader *pfile)
 
   if (reason == LC_LEAVE)
     {
+      /* Reread map since cpp_get_token can invalidate it with a
+        reallocation.  */
+      map = LINEMAPS_LAST_ORDINARY_MAP (line_table);
       const line_map_ordinary *from;      
       if (MAIN_FILE_P (map)
          || (new_file
@@ -1055,7 +1058,8 @@ do_linemarker (cpp_reader *pfile)
              && 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);
+                      "file \"%s\" linemarker ignored due to "
+                      "incorrect nesting", new_file);
          return;
        }
     }