diff mbox series

Fix old thinko in choose_multiplier

Message ID 5021641.5L4pSmURtV@polaris
State New
Headers show
Series Fix old thinko in choose_multiplier | expand

Commit Message

Eric Botcazou July 4, 2018, 12:56 p.m. UTC
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  <ebotcazou@adacore.com>

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

Patch

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
     {