This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

incorrect implementations of libgcc overflow checkingarithmetic selected for 64-bit targets


Missing redirection of overflow-checking libgcc2 functions caused
random
failures of the gcc.dg/ftrapv-1.c test on 64-bit targets.
Since I consider this a bug worth fixing in the 3.4 branch, I'm also
attaching
a respective patch.
In the course of fixing this it became obvious that there also is a
missing
dependency (on libgcc2.h) in the libgcc makefiles.

Bootstrapped and tested on x86_64-unknown-linux-gnu.

Jan

gcc/
2004-12-14 Jan Beulich  <jbeulich@novell.com>
	* libgcc2.h ({add,sub,neg,mul,abs}v[sd]i[23]): Rename to 
	{add,sub,neg,mul,abs}v[SI]I[23] and add redirecting definitions
	matching those for other functions.
	* libgcc2.c ({add,sub,neg,mul,abs}v[sd]i[23]): Use macro names
instead
	of real ones.
	* mklibgcc.in (libgcc2_c_dep): Add dependency on libgcc2.h.

---
/home/jbeulich/src/gcc/mainline/2004-12-13.08.53/gcc/libgcc2.c	2004-11-25
13:31:01.000000000 +0100
+++ 2004-12-13.08.53/gcc/libgcc2.c	2004-12-14 10:56:07.963265384
+0100
@@ -73,7 +73,7 @@ __negdi2 (DWtype u)
 
 #ifdef L_addvsi3
 Wtype
-__addvsi3 (Wtype a, Wtype b)
+__addvSI3 (Wtype a, Wtype b)
 {
   const Wtype w = a + b;
 
@@ -86,7 +86,7 @@ __addvsi3 (Wtype a, Wtype b)
 
 #ifdef L_addvdi3
 DWtype
-__addvdi3 (DWtype a, DWtype b)
+__addvDI3 (DWtype a, DWtype b)
 {
   const DWtype w = a + b;
 
@@ -99,7 +99,7 @@ __addvdi3 (DWtype a, DWtype b)
 
 #ifdef L_subvsi3
 Wtype
-__subvsi3 (Wtype a, Wtype b)
+__subvSI3 (Wtype a, Wtype b)
 {
   const DWtype w = a - b;
 
@@ -112,7 +112,7 @@ __subvsi3 (Wtype a, Wtype b)
 
 #ifdef L_subvdi3
 DWtype
-__subvdi3 (DWtype a, DWtype b)
+__subvDI3 (DWtype a, DWtype b)
 {
   const DWtype w = a - b;
 
@@ -126,7 +126,7 @@ __subvdi3 (DWtype a, DWtype b)
 #ifdef L_mulvsi3
 #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
 Wtype
-__mulvsi3 (Wtype a, Wtype b)
+__mulvSI3 (Wtype a, Wtype b)
 {
   const DWtype w = (DWtype) a * (DWtype) b;
 
@@ -139,7 +139,7 @@ __mulvsi3 (Wtype a, Wtype b)
 
 #ifdef L_negvsi2
 Wtype
-__negvsi2 (Wtype a)
+__negvSI2 (Wtype a)
 {
   const Wtype w = -a;
 
@@ -152,7 +152,7 @@ __negvsi2 (Wtype a)
 
 #ifdef L_negvdi2
 DWtype
-__negvdi2 (DWtype a)
+__negvDI2 (DWtype a)
 {
   const DWtype w = -a;
 
@@ -165,13 +165,13 @@ __negvdi2 (DWtype a)
 
 #ifdef L_absvsi2
 Wtype
-__absvsi2 (Wtype a)
+__absvSI2 (Wtype a)
 {
   Wtype w = a;
 
   if (a < 0)
 #ifdef L_negvsi2
-    w = __negvsi2 (a);
+    w = __negvSI2 (a);
 #else
     w = -a;
 
@@ -185,13 +185,13 @@ __absvsi2 (Wtype a)
 
 #ifdef L_absvdi2
 DWtype
-__absvdi2 (DWtype a)
+__absvDI2 (DWtype a)
 {
   DWtype w = a;
 
   if (a < 0)
 #ifdef L_negvdi2
-    w = __negvdi2 (a);
+    w = __negvDI2 (a);
 #else
     w = -a;
 
@@ -206,7 +206,7 @@ __absvdi2 (DWtype a)
 #ifdef L_mulvdi3
 #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
 DWtype
-__mulvdi3 (DWtype u, DWtype v)
+__mulvDI3 (DWtype u, DWtype v)
 {
   /* The unchecked multiplication needs 3 Wtype x Wtype
multiplications,
      but the checked multiplication needs only two.  */
---
/home/jbeulich/src/gcc/mainline/2004-12-13.08.53/gcc/libgcc2.h	2004-12-13
08:29:41.000000000 +0100
+++ 2004-12-13.08.53/gcc/libgcc2.h	2004-12-14 10:56:07.965265080
+0100
@@ -197,6 +197,18 @@ typedef int word_type __attribute__ ((mo
 #define __cmpdi2	__NDW(cmp,2)
 #define __ucmpdi2	__NDW(ucmp,2)
 #define __udivmoddi4	__NDW(udivmod,4)
+
+#define __absvSI2	__NW(absv,2)
+#define __addvSI3	__NW(addv,3)
+#define __mulvSI3	__NW(mulv,3)
+#define __negvSI2	__NW(negv,2)
+#define __subvSI3	__NW(subv,3)
+#define __absvDI2	__NDW(absv,2)
+#define __addvDI3	__NDW(addv,3)
+#define __mulvDI3	__NDW(mulv,3)
+#define __negvDI2	__NDW(negv,2)
+#define __subvDI3	__NDW(subv,3)
+
 #define __fixunstfDI	__NDW(fixunstf,)
 #define __fixtfdi	__NDW(fixtf,)
 #define __fixunsxfDI	__NDW(fixunsxf,)
@@ -255,16 +267,16 @@ extern UWtype __udiv_w_sdiv (UWtype *, U
 extern word_type __cmpdi2 (DWtype, DWtype);
 extern word_type __ucmpdi2 (DWtype, DWtype);
 
-extern Wtype __absvsi2 (Wtype);
-extern DWtype __absvdi2 (DWtype);
-extern Wtype __addvsi3 (Wtype, Wtype);
-extern DWtype __addvdi3 (DWtype, DWtype);
-extern Wtype __subvsi3 (Wtype, Wtype);
-extern DWtype __subvdi3 (DWtype, DWtype);
-extern Wtype __mulvsi3 (Wtype, Wtype);
-extern DWtype __mulvdi3 (DWtype, DWtype);
-extern Wtype __negvsi2 (Wtype);
-extern DWtype __negvdi2 (DWtype);
+extern Wtype __absvSI2 (Wtype);
+extern DWtype __absvDI2 (DWtype);
+extern Wtype __addvSI3 (Wtype, Wtype);
+extern DWtype __addvDI3 (DWtype, DWtype);
+extern Wtype __subvSI3 (Wtype, Wtype);
+extern DWtype __subvDI3 (DWtype, DWtype);
+extern Wtype __mulvSI3 (Wtype, Wtype);
+extern DWtype __mulvDI3 (DWtype, DWtype);
+extern Wtype __negvSI2 (Wtype);
+extern DWtype __negvDI2 (DWtype);
 
 #if BITS_PER_UNIT == 8
 extern DWtype __fixdfdi (DFtype);
---
/home/jbeulich/src/gcc/mainline/2004-12-13.08.53/gcc/mklibgcc.in	2004-12-13
08:29:41.000000000 +0100
+++ 2004-12-13.08.53/gcc/mklibgcc.in	2004-12-14 10:53:18.118085776
+0100
@@ -85,7 +85,7 @@ make_compile='$(MAKE) GCC_FOR_TARGET="$(
 libgcc_dep='$(CONFIG_H) coretypes.h $(TM_H) $(MACHMODE_H) longlong.h
config.status stmp-int-hdrs tsystem.h'
 
 # Dependencies for libgcc2.c
-libgcc2_c_dep='stmp-dirs $(srcdir)/libgcc2.c gbl-ctors.h'"
$libgcc_dep"
+libgcc2_c_dep='stmp-dirs $(srcdir)/libgcc2.c $(srcdir)/libgcc2.h
gbl-ctors.h'" $libgcc_dep"
 
 # Dependencies for libgcov.c
 libgcov_c_dep='stmp-dirs $(srcdir)/libgcov.c $(srcdir)/gcov-io.h
$(srcdir)/gcov-io.c gcov-iov.h'" $libgcc_dep"

Attachment: gcc-3.4.3-libgcc-trapv.patch
Description: Binary data

Attachment: gcc-mainline-libgcc-trapv.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]