This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/15526] [3.4/3.5 Regression] -ftrapv aborts on 0 * (-1)
- From: "falk at debian dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 May 2004 22:24:37 -0000
- Subject: [Bug other/15526] [3.4/3.5 Regression] -ftrapv aborts on 0 * (-1)
- References: <20040518204337.15526.schnetter@aei.mpg.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From falk at debian dot org 2004-05-18 22:24 -------
This should fix it (but I don't have the proper platform to test it):
diff -u -p -r1.170 libgcc2.c
--- libgcc2.c 14 Nov 2003 02:23:13 -0000 1.170
+++ libgcc2.c 18 May 2004 22:21:45 -0000
@@ -130,9 +130,7 @@ __mulvsi3 (Wtype a, Wtype b)
{
const DWtype w = (DWtype) a * (DWtype) b;
- if (((a >= 0) == (b >= 0))
- ? (UDWtype) w > (UDWtype) (((DWtype) 1 << (WORD_SIZE - 1)) - 1)
- : (UDWtype) w < (UDWtype) ((DWtype) -1 << (WORD_SIZE - 1)))
+ if ((Wtype) (w >> WORD_SIZE) != (Wtype) w >> (WORD_SIZE - 1))
abort ();
return w;
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15526