Commit d3a7ef9a by Falk Hueffner Committed by Falk Hueffner

re PR other/15526 (-ftrapv aborts on 0 * (-1))

	PR other/15526
	* libgcc2.c (__mulvsi3): Fix overflow test.
	* gcc.dg/ftrapv-1.c: New test case.

From-SVN: r82042
parent dc44e18a
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
......
......@@ -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;
......
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.
......
/* 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment