Re: [PATCH] PARISC: Avoid undefined shift in cnv_float.h
|[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
On 1-Apr-12, at 1:06 PM, James Bottomley wrote:
On Sun, 2012-04-01 at 12:57 -0400, John David Anglin wrote:The attached change fixes a float conversion problem found running theGCC testsuite with GCC configured with --with-arch=2.0.Could you describe the actual problem? (it helps enormously when peoplelook at the change logs a year later and try and work out what the actual issue is).
The actual problem occurs for an exponent value of 63. This is the maximum exponent value that can be passed. This causes a left shift by 32 in the else hunk of the macro. This causes undefined behavior and the wrong value is returned for dresultB. The fix is the check "exponent <= 62". If the exponent
is 63, dresultB is set to 0. The patch also optimizes the operation a bit by copying"Sall(sgl_value) << SGL_EXP_LENGTH" to val, so that sgl_value is not modified.
Dave -- John David Anglin dave.anglin@xxxxxxxx -- To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html