This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[wide-int] Fix exact_log2 zext test
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: zadeck at naturalbridge dot com, mikestump at comcast dot net
- Date: Sat, 02 Nov 2013 10:19:35 +0000
- Subject: [wide-int] Fix exact_log2 zext test
- Authentication-results: sourceware.org; auth=none
...which I'd fluffed when doing the wi:: conversion.
Tested on powerpc64-linux-gnu and x86_64-linux-gnu. It fixed a spurious
gcc.dg difference on alpha-linux-gnu. Applied as obvious.
Thanks,
Richard
Index: gcc/wide-int.cc
===================================================================
--- gcc/wide-int.cc (revision 204311)
+++ gcc/wide-int.cc (working copy)
@@ -2044,7 +2044,7 @@
/* Get a zero-extended form of block CRUX. */
unsigned HOST_WIDE_INT hwi = x.val[crux];
- if (crux * HOST_BITS_PER_WIDE_INT > x.precision)
+ if ((crux + 1) * HOST_BITS_PER_WIDE_INT > x.precision)
hwi = zext_hwi (hwi, x.precision % HOST_BITS_PER_WIDE_INT);
/* Now it's down to whether HWI is a power of 2. */