Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Paul Eggert
Thu, 12 Nov 1992 02:59
missing cast to USItype in libgcc2.c
Author: Paul Eggert
Date: Thu, 12 Nov 1992 02:59
Date: Thu, 12 Nov 1992 02:59
34 lines
1537 bytes
1537 bytes
A missing cast to (USItype) in libgcc2.c causes problems when sizeof(USItype)
> sizeof(int), because it subtracts 2^31 instead of adding it. This bug was
discovered with the arithmetic overflow patches that I'll send in my next
message. Here is a patch.
Thu Nov 12 02:44:18 1992 Paul Eggert (eggert@twinsun.com)
* libgcc2.c (__udiv_w_sdiv): Avoid overflow when sizeof(USItype) >
sizeof(int).
===================================================================
RCS file: libgcc2.c,v
retrieving revision 2.3.1.1
retrieving revision 2.3.1.2
diff -c -r2.3.1.1 -r2.3.1.2
*** libgcc2.c 1992/11/06 11:59:59 2.3.1.1
--- libgcc2.c 1992/11/12 02:44:18 2.3.1.2
***************
*** 296,302 ****
/* Divide (c1*2^32 + c0) by d */
sdiv_qrnnd (q, r, c1, c0, d);
/* Add 2^31 to quotient */
! q += 1 << 31;
}
}
else
--- 296,302 ----
/* Divide (c1*2^32 + c0) by d */
sdiv_qrnnd (q, r, c1, c0, d);
/* Add 2^31 to quotient */
! q += (USItype) 1 << 31;
}
}
else
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads