This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix linemap_line_start (PR preprocessor/60436)


Hi!

As mentioned in the PR, when preprocessing very large files, if there are
huge numbers of lines where no #line is emitted, we might not detect
overflowinging into adhoc locations.
Apparently in the add_map case we already handle that fine, by first
stopping tracking columns and after another 256M lines give up on tracking
locations, so this patch just makes sure we enter that path if
going over those limits.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2014-11-24  Jakub Jelinek  <jakub@redhat.com>

	PR preprocessor/60436
	* line-map.c (linemap_line_start): If highest is above 0x60000000
	and we are still tracking columns or highest is above 0x70000000,
	force add_map.

--- libcpp/line-map.c.jj	2014-11-12 08:06:57.000000000 +0100
+++ libcpp/line-map.c	2014-11-24 12:14:52.691276169 +0100
@@ -529,10 +529,10 @@ linemap_line_start (struct line_maps *se
 	  && line_delta * ORDINARY_MAP_NUMBER_OF_COLUMN_BITS (map) > 1000)
       || (max_column_hint >= (1U << ORDINARY_MAP_NUMBER_OF_COLUMN_BITS (map)))
       || (max_column_hint <= 80
-	  && ORDINARY_MAP_NUMBER_OF_COLUMN_BITS (map) >= 10))
-    {
-      add_map = true;
-    }
+	  && ORDINARY_MAP_NUMBER_OF_COLUMN_BITS (map) >= 10)
+      || (highest > 0x60000000
+	  && (set->max_column_hint || highest > 0x70000000)))
+    add_map = true;
   else
     max_column_hint = set->max_column_hint;
   if (add_map)
@@ -543,7 +543,7 @@ linemap_line_start (struct line_maps *se
 	  /* If the column number is ridiculous or we've allocated a huge
 	     number of source_locations, give up on column numbers. */
 	  max_column_hint = 0;
-	  if (highest >0x70000000)
+	  if (highest > 0x70000000)
 	    return 0;
 	  column_bits = 0;
 	}

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]