PR other/15526
* libgcc2.c (__mulvsi3): Fix overflow test.
* gcc.dg/ftrapv-1.c: New test case.
From-SVN: r82042
+2004-05-20 Falk Hueffner <falk@debian.org>
+
+ PR other/15526
+ * libgcc2.c (__mulvsi3): Fix overflow test.
+
2004-05-19 Andrew Pinski <pinskia@physics.uc.edu>
PR c/14171
{
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;
+2004-05-20 Falk Hueffner <falk@debian.org>
+
+ PR other/15526
+ * gcc.dg/ftrapv-1.c: New test case.
+
2004-05-18 Feng Wang <fengwang@nudt.edu.cn>
* gfortran.fortran-torture/execute/power.f90: Test constant integers.
--- /dev/null
+/* Copyright (C) 2004 Free Software Foundation.
+
+ PR other/15526
+ Verify correct overflow checking with -ftrapv.
+
+ Written by Falk Hueffner, 20th May 2004. */
+
+/* { dg-do run } */
+/* { dg-options "-ftrapv" } */
+
+__attribute__((noinline)) int
+mulv(int a, int b)
+{
+ return a * b;
+}
+
+int
+main()
+{
+ mulv( 0, 0);
+ mulv( 0, -1);
+ mulv(-1, 0);
+ mulv(-1, -1);
+ return 0;
+}