summaryrefslogtreecommitdiff
path: root/gcc/libgcc2.c
diff options
context:
space:
mode:
authorFalk Hueffner <falk@debian.org>2004-05-20 01:43:20 +0200
committerFalk Hueffner <falk@gcc.gnu.org>2004-05-20 01:43:20 +0200
commitd3a7ef9aacb50cbcd85a34966da10304f048a576 (patch)
treed28c06eae10c078a6f4d7fc45d0fc1a6a827772f /gcc/libgcc2.c
parentdc44e18a62f2bb07638dbd467c2df88c58424346 (diff)
downloadgcc-d3a7ef9aacb50cbcd85a34966da10304f048a576.tar.gz
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
Diffstat (limited to 'gcc/libgcc2.c')
-rw-r--r--gcc/libgcc2.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/gcc/libgcc2.c b/gcc/libgcc2.c
index 34171ad9002..8a953ea8b76 100644
--- a/gcc/libgcc2.c
+++ b/gcc/libgcc2.c
@@ -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;