As spotted by the reporter of the bug, there is a small thinko at the end of 
choose_multiplier whereby the (N + 1)th bit of the result is set when the 
computed value is exactly 2**N.  But it turns out that this case can never 
actually happen given how the function is invoked in the compiler.

Bootstrapped/regtested on x86-64/Linux, applied on the mainline as obvious.


2018-07-04  Eric Botcazou  <ebotca...@adacore.com>

        PR middle-end/86380
        * expmed.c (choose_multiplier): Fix incorrect comparison with mask.

-- 
Eric Botcazou
Index: expmed.c
===================================================================
--- expmed.c	(revision 262339)
+++ expmed.c	(working copy)
@@ -3678,7 +3678,7 @@ choose_multiplier (unsigned HOST_WIDE_IN
     {
       unsigned HOST_WIDE_INT mask = (HOST_WIDE_INT_1U << n) - 1;
       *multiplier_ptr = mhigh.to_uhwi () & mask;
-      return mhigh.to_uhwi () >= mask;
+      return mhigh.to_uhwi () > mask;
     }
   else
     {

Reply via email to