[Bug libfortran/14396] [gfortran] Intrinsic SQRT and CSQRT give wrong answer with COMPLEX argument.

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Mar 6 04:14:00 GMT 2004


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-06 04:14 -------
The problem comes from libgfortran's csqrt which is not used always (for targets with C99 math 
functions it is not used at all, I do not have a list of targets which have C99 math functions and which 
do not):

>From bud davis:
/* sqrt(z).  Algorithm pulled from glibc.  */
GFC_COMPLEX_4
csqrtf (GFC_COMPLEX_4 z)
{
 GFC_REAL_4 re;
 GFC_REAL_4 im;
 GFC_COMPLEX_4 v;
                                                                               
 re = REALPART (re);   <--- should be z
 im = IMAGPART (im);  <--- should be z

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
          Component|fortran                     |libfortran
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-03-06 04:14:44
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14396



More information about the Gcc-bugs mailing list