]> Pileus Git - ~andy/linux/commit
parisc: avoid undefined shift in cnv_float.h
authorJohn David Anglin <dave.anglin@bell.net>
Sun, 1 Apr 2012 16:57:18 +0000 (12:57 -0400)
committerHelge Deller <deller@gmx.de>
Mon, 7 Jan 2013 22:06:22 +0000 (23:06 +0100)
commitcabd91c3bb74a5bc43c3192126af752891d11d77
tree96be8d73cfe3a5228ecfee947d5dc6b2498503e8
parentd287b8750e47c1702dab0e37ac11012bb751ece0
parisc: avoid undefined shift in cnv_float.h

The attached change fixes a float conversion problem found running the
GCC testsuite with GCC configured with --with-arch=2.0.

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.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
arch/parisc/math-emu/cnv_float.h