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
This commit is contained in:
parent
dc44e18a62
commit
d3a7ef9aac
4 changed files with 36 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
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;
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
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.
|
||||
|
|
25
gcc/testsuite/gcc.dg/ftrapv-1.c
Normal file
25
gcc/testsuite/gcc.dg/ftrapv-1.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* 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;
|
||||
}
|
Loading…
Add table
Reference in a new issue