From a5f87af7edff53d77f51ba253da42dbfc74ada58 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 18 Feb 2019 10:46:19 +0100 Subject: [PATCH] Use 1UL constant in order to not overflow (PR c++/89383). 2019-02-18 Martin Liska PR c++/89383 * line-map.c (linemap_line_start): Use 1UL in order to not overflow. From-SVN: r268981 --- libcpp/ChangeLog | 6 ++++++ libcpp/line-map.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 8af9846d7fb..fa2fa7d97e8 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,9 @@ +2019-02-18 Martin Liska + + PR c++/89383 + * line-map.c (linemap_line_start): Use 1UL in order + to not overflow. + 2019-02-11 Martin Liska PR lto/88147 diff --git a/libcpp/line-map.c b/libcpp/line-map.c index 0e30b4b2b39..b73f5067c24 100644 --- a/libcpp/line-map.c +++ b/libcpp/line-map.c @@ -745,7 +745,8 @@ linemap_line_start (struct line_maps *set, linenum_type to_line, || ( /* 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))) + >= (((uint64_t) 1) + << (CHAR_BIT * sizeof (linenum_type) - column_bits))) || range_bits < map->m_range_bits) map = linemap_check_ordinary (const_cast -- 2.30.2