This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug other/15526] [3.4/3.5 Regression] -ftrapv aborts on 0 * (-1)


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]