From: Martin Liska Date: Mon, 11 Mar 2019 11:18:22 +0000 (+0100) Subject: Backport r268981 X-Git-Tag: releases/gcc-7.5.0~547 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0123e517815a1a25893774860b6df50160c39d58;p=thirdparty%2Fgcc.git Backport r268981 2019-03-11 Martin Liska Backport from mainline 2019-02-18 Martin Liska PR c++/89383 * line-map.c (linemap_line_start): Use 1UL in order to not overflow. From-SVN: r269577 --- diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index df7072e6fa19..ee3cdb2cfd6e 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,12 @@ +2019-03-11 Martin Liska + + Backport from mainline + 2019-02-18 Martin Liska + + PR c++/89383 + * line-map.c (linemap_line_start): Use 1UL in order + to not overflow. + 2019-03-11 Martin Liska Backport from mainline diff --git a/libcpp/line-map.c b/libcpp/line-map.c index 5827f303b6df..ddcb0111f4b3 100644 --- a/libcpp/line-map.c +++ b/libcpp/line-map.c @@ -756,7 +756,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