From: Aldy Hernandez Date: Tue, 22 Aug 2017 08:25:24 +0000 (+0000) Subject: * wide-int.h (hwi_with_prec::hwi_with_prec): Sign extend. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4ea9e1a52406d50c63987098c060a1c54d52b46c;p=gcc.git * wide-int.h (hwi_with_prec::hwi_with_prec): Sign extend. From-SVN: r251260 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5866bb0d8a8..2e482b040e3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2017-08-22 Aldy Hernandez + + * wide-int.h (hwi_with_prec::hwi_with_prec): Sign extend. + 2017-08-22 Georg-Johann Lay PR target/81910 diff --git a/gcc/wide-int.h b/gcc/wide-int.h index 2115b614a9f..0596f984118 100644 --- a/gcc/wide-int.h +++ b/gcc/wide-int.h @@ -1517,8 +1517,12 @@ namespace wi inline wi::hwi_with_prec::hwi_with_prec (HOST_WIDE_INT v, unsigned int p, signop s) - : val (v), precision (p), sgn (s) + : precision (p), sgn (s) { + if (precision < HOST_BITS_PER_WIDE_INT) + val = sext_hwi (v, precision); + else + val = v; } /* Return a signed integer that has value VAL and precision PRECISION. */