[patch] Fix PR middle-end/41009

John David Anglin dave@hiauly1.hia.nrc.ca
Fri Sep 18 01:22:00 GMT 2009


Backporting the fix for PR 37850 fixes PR 41009.  Tested on
hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11 with no regressions.

Ok to apply to 4.3?

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2009-09-17  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	PR middle-end/41009
	Backport from mainline
	2009-03-10  Richard Guenther  <rguenther@suse.de>
	Nathan Froyd  <froydnj@codesourcery.com>

	PR middle-end/37850
	* libgcc2.c (__mulMODE3): Use explicit assignments to form the result.
	(__divMODE3): Likewise.

Index: libgcc2.c
===================================================================
--- libgcc2.c	(revision 150499)
+++ libgcc2.c	(working copy)
@@ -1830,6 +1830,7 @@
 CONCAT3(__mul,MODE,3) (MTYPE a, MTYPE b, MTYPE c, MTYPE d)
 {
   MTYPE ac, bd, ad, bc, x, y;
+  CTYPE res;
 
   ac = a * c;
   bd = b * d;
@@ -1886,7 +1887,9 @@
 	}
     }
 
-  return x + I * y;
+  __real__ res = x;
+  __imag__ res = y;
+  return res;
 }
 #endif /* complex multiply */
 
@@ -1897,6 +1900,7 @@
 CONCAT3(__div,MODE,3) (MTYPE a, MTYPE b, MTYPE c, MTYPE d)
 {
   MTYPE denom, ratio, x, y;
+  CTYPE res;
 
   /* ??? We can get better behavior from logarithmic scaling instead of
      the division.  But that would mean starting to link libgcc against
@@ -1942,7 +1946,9 @@
 	}
     }
 
-  return x + I * y;
+  __real__ res = x;
+  __imag__ res = y;
+  return res;
 }
 #endif /* complex divide */
 



More information about the Gcc-patches mailing list