case rvc_normal:
if (r->exp <= 0)
goto underflow;
+ /* Only force overflow for unsigned overflow. Signed overflow is
+ undefined, so it doesn't matter what we return, and some callers
+ expect to be able to use this routine for both signed and
+ unsigned conversions. */
if (r->exp > HOST_BITS_PER_WIDE_INT)
goto overflow;
exp = r->exp;
if (exp <= 0)
goto underflow;
+ /* Only force overflow for unsigned overflow. Signed overflow is
+ undefined, so it doesn't matter what we return, and some callers
+ expect to be able to use this routine for both signed and
+ unsigned conversions. */
if (exp > 2*HOST_BITS_PER_WIDE_INT)
goto overflow;