[Bug tree-optimization/69399] [5/6 Regression] wrong code with -O and int128
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jan 21 19:47:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69399
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
wide-int.h has
/* Return X >> Y, using a logical shift. Return 0 if Y is greater than
or equal to the precision of X. */
template <typename T1, typename T2>
inline WI_UNARY_RESULT (T1)
wi::lrshift (const T1 &x, const T2 &y)
{
WI_UNARY_RESULT_VAR (result, val, T1, x);
/* Do things in the precision of the input rather than the output,
since the result can be no larger than that. */
WIDE_INT_REF_FOR (T1) xi (x);
WIDE_INT_REF_FOR (T2) yi (y);
/* Handle the simple cases quickly. */
if (geu_p (yi, xi.precision))
{
val[0] = 0;
result.set_len (1);
}
else
{
unsigned int shift = yi.to_uhwi ();
/* For fixed-precision integers like offset_int and widest_int,
handle the case where the shift value is constant and the
shifted value is a single nonnegative HWI (meaning that all
bits above the HWI are zero). This is particularly common
for converting a bit count to a byte count.
For variable-precision integers like wide_int, handle HWI
and sub-HWI integers inline. */
if (STATIC_CONSTANT_P (xi.precision > HOST_BITS_PER_WIDE_INT)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is miscompiled due to PR 65656.
? xi.len == 1 && xi.val[0] >= 0
: xi.precision <= HOST_BITS_PER_WIDE_INT)
{
val[0] = xi.to_uhwi () >> shift;
result.set_len (1);
}
else
result.set_len (lrshift_large (val, xi.val, xi.len, xi.precision,
get_precision (result), shift));
}
return result;
}
*** This bug has been marked as a duplicate of bug 65656 ***
More information about the Gcc-bugs
mailing list