diff options
author | Martin Liska <mliska@suse.cz> | 2019-03-11 10:37:41 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2019-03-11 09:37:41 +0000 |
commit | bfda391bdbd38d916e9007d35ed27abdaf7e39af (patch) | |
tree | 14c5ced9d3b28a77676674d6f739823ffed29b21 /libcpp | |
parent | b9ce7ea14f9d5482b2a46b921649956563606a44 (diff) | |
download | gcc-bfda391bdbd38d916e9007d35ed27abdaf7e39af.zip gcc-bfda391bdbd38d916e9007d35ed27abdaf7e39af.tar.gz gcc-bfda391bdbd38d916e9007d35ed27abdaf7e39af.tar.bz2 |
Backport r268789
2019-03-11 Martin Liska <mliska@suse.cz>
Backport from mainline
2019-02-11 David Malcolm <dmalcolm@redhat.com>
PR lto/88147
* input.c (selftest::test_line_offset_overflow): New selftest.
(selftest::input_c_tests): Call it.
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.
From-SVN: r269570
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 10 | ||||
-rw-r--r-- | libcpp/line-map.c | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index afc70cf..e29f66d 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,13 @@ +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 a84084c..42aecd6 100644 --- a/libcpp/line-map.c +++ b/libcpp/line-map.c @@ -755,6 +755,10 @@ 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)) + >= (1U << (CHAR_BIT * sizeof (linenum_type) - column_bits))) || range_bits < map->m_range_bits) map = linemap_check_ordinary (const_cast <line_map *> |