aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog19
-rw-r--r--libcpp/line-map.c5
2 files changed, 24 insertions, 0 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index afc70cfce6c..bc1208a689b 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,22 @@
+2019-03-11 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2019-02-18 Martin Liska <mliska@suse.cz>
+
+ PR c++/89383
+ * line-map.c (linemap_line_start): Use 1UL in order
+ to not overflow.
+
+2019-03-11 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2019-02-11 Martin Liska <mliska@suse.cz>
+
+ PR lto/88147
+ * line-map.c (linemap_line_start): Don't reuse the existing line
+ map if the line offset is sufficiently large to cause overflow
+ when computing location_t values.
+
2019-02-22 Release Manager
* GCC 8.3.0 released.
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index a84084c99f0..72fe2c0dcec 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -755,6 +755,11 @@ linemap_line_start (struct line_maps *set, linenum_type to_line,
if (line_delta < 0
|| last_line != ORDINARY_MAP_STARTING_LINE_NUMBER (map)
|| SOURCE_COLUMN (map, highest) >= (1U << (column_bits - range_bits))
+ || ( /* We can't reuse the map if the line offset is sufficiently
+ large to cause overflow when computing location_t values. */
+ (to_line - ORDINARY_MAP_STARTING_LINE_NUMBER (map))
+ >= (((uint64_t) 1)
+ << (CHAR_BIT * sizeof (linenum_type) - column_bits)))
|| range_bits < map->m_range_bits)
map = linemap_check_ordinary
(const_cast <line_map *>