aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2018-08-24 23:37:53 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2018-08-24 16:37:53 -0700
commitcf806c7dc305fe14654b44ed7cfe0a35c7947af1 (patch)
tree72bc779dc191ac96322f334117fcb4cbd6455084 /libcpp
parentacf6214eacc97d0779e73c7ab6539ecb3dd1d524 (diff)
downloadgcc-cf806c7dc305fe14654b44ed7cfe0a35c7947af1.zip
gcc-cf806c7dc305fe14654b44ed7cfe0a35c7947af1.tar.gz
gcc-cf806c7dc305fe14654b44ed7cfe0a35c7947af1.tar.bz2
Set start_location to 0 if we ran out of line map space
With profiledbootstrap and --with-build-config=bootstrap-lto, linemap_add may create a macro map when we run out of line map space. This patch changes start_location to UNKNOWN_LOCATION (0) in this case. Tested with profiledbootstrap and --with-build-config=bootstrap-lto on Linux/x86-64. PR bootstrap/86872 * line-map.c (pure_location_p): Return true if linemap_lookup returns NULL. (linemap_add): Set start_location to 0 if we run out of line map space. From-SVN: r263845
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog8
-rw-r--r--libcpp/line-map.c7
2 files changed, 15 insertions, 0 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index de6f542..cbf4cbf 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,11 @@
+2018-08-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR bootstrap/86872
+ * line-map.c (pure_location_p): Return true if linemap_lookup
+ returns NULL.
+ (linemap_add): Set start_location to 0 if we run out of line map
+ space.
+
2018-08-20 Nathan Sidwell <nathan@acm.org>
* include/cpplib.h: Fixup some whitespace.
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index f0e6318..b5e1f13 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -304,6 +304,8 @@ pure_location_p (line_maps *set, source_location loc)
return false;
const line_map *map = linemap_lookup (set, loc);
+ if (map == NULL)
+ return true;
const line_map_ordinary *ordmap = linemap_check_ordinary (map);
if (loc & ((1U << ordmap->m_range_bits) - 1))
@@ -492,6 +494,11 @@ linemap_add (struct line_maps *set, enum lc_reason reason,
}
linemap_assert (reason != LC_ENTER_MACRO);
+
+ if (start_location >= LINE_MAP_MAX_LOCATION)
+ /* We ran out of line map space. */
+ start_location = 0;
+
line_map_ordinary *map
= linemap_check_ordinary (new_linemap (set, start_location));
map->reason = reason;