This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug math/7006] New: Bad left shift in _FP_FRAC_SRS_2 macro in soft-fp/op-2.h on SH-4
- From: "ilyes dot gouta at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 5 Nov 2008 16:10:46 -0000
- Subject: [Bug math/7006] New: Bad left shift in _FP_FRAC_SRS_2 macro in soft-fp/op-2.h on SH-4
- Reply-to: sourceware-bugzilla at sourceware dot org
Hi all,
I hit this bug two years ago while porting a VM on SH-4. The bug is located in
soft-fp/op-2.h, in the macro _FP_FRAC_SRS_2. The bug is in the line 95:
X##_f0 = (X##_f1 << (_FP_W_TYPE_SIZE - (N)) | X##_f0 >> (N) | \
I had to change it to:
X##_f0 = ((X##_f1 << (_FP_W_TYPE_SIZE - (N) - 1)) << 1 | X##_f0 >> (N) | \
Because in the extreme case where you have N == 0 and _FP_W_TYPE_SIZE == 32,
X##_f1 << (_FP_W_TYPE_SIZE - (N)) would return 0, however on SH-4, it returns
X##_f1 since only 5 bits are used in the shift instruction, SHLD, to encode the
shift amount, and 32 (which spans 6 bits) will be masked to 0. This issue can
also be attributed to the SH-4 GCC compiler.
Regards,
Ilyes Gouta.
--
Summary: Bad left shift in _FP_FRAC_SRS_2 macro in soft-fp/op-2.h
on SH-4
Product: glibc
Version: 2.8
Status: NEW
Severity: normal
Priority: P2
Component: math
AssignedTo: aj at suse dot de
ReportedBy: ilyes dot gouta at gmail dot com
CC: glibc-bugs at sources dot redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=7006
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.