From: Jakub Jelinek Date: Fri, 30 Aug 2019 11:50:35 +0000 (+0200) Subject: backport: re PR middle-end/89281 (gcc/optabs.c:3901:30: runtime error: shift exponent... X-Git-Tag: releases/gcc-7.5.0~255 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=759561630909c5145f283850eb9f9970be78bed2;p=thirdparty%2Fgcc.git backport: re PR middle-end/89281 (gcc/optabs.c:3901:30: runtime error: shift exponent 32 is too large for 32-bit type 'int') Backported from mainline 2019-02-13 Jakub Jelinek PR middle-end/89281 * optabs.c (prepare_cmp_insn): Use UINTVAL (size) instead of INTVAL (size), compare it to GET_MODE_MASK instead of 1 << GET_MODE_BITSIZE. From-SVN: r275108 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4bfe52f52377..29db4f3b39f6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,13 @@ 2019-08-30 Jakub Jelinek Backported from mainline + 2019-02-13 Jakub Jelinek + + PR middle-end/89281 + * optabs.c (prepare_cmp_insn): Use UINTVAL (size) instead of + INTVAL (size), compare it to GET_MODE_MASK instead of + 1 << GET_MODE_BITSIZE. + 2019-02-09 Jakub Jelinek PR middle-end/89246 diff --git a/gcc/optabs.c b/gcc/optabs.c index d3624fdf9ef9..ba4b9ad1bd19 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -3811,7 +3811,7 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx_code comparison, rtx size, /* Must make sure the size fits the insn's mode. */ if ((CONST_INT_P (size) - && INTVAL (size) >= (1 << GET_MODE_BITSIZE (cmp_mode))) + && UINTVAL (size) > GET_MODE_MASK (cmp_mode)) || (GET_MODE_BITSIZE (GET_MODE (size)) > GET_MODE_BITSIZE (cmp_mode))) continue;