public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/25370]  New: Bad value for sqrt of double complex
@ 2005-12-12 15:28 fxcoudert at gcc dot gnu dot org
  2005-12-12 15:43 ` [Bug libfortran/25370] " fxcoudert at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-12-12 15:28 UTC (permalink / raw)
  To: gcc-bugs

This code exhibit a weird dependance on whether it is statically linked or
dynamically linked:

$ cat foo.f90 
complex c
double complex d

c = (-1., 0.)
print *, c, sqrt(c)
d = c
print *, d, sqrt(d)
end

$ ./bin/gfortran -static foo.f90 && ./a.out
 ( -1.000000    ,  0.000000    ) (  0.000000    ,  1.000000    )
 ( -1.00000000000000     ,  0.00000000000000     ) (  0.00000000000000     , 
1.00000000000000     )
$ ./bin/gfortran foo.f90 && ./a.out
 ( -1.000000    ,  0.000000    ) (  0.000000    ,  1.000000    )
 ( -1.00000000000000     ,  0.00000000000000     ) ( 1.397677071793657E-312,
3.756040694101013E-317)


-- 
           Summary: Bad value for sqrt of double complex
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fxcoudert at gcc dot gnu dot org
 GCC build triplet: i386-pc-solaris2.9
  GCC host triplet: i386-pc-solaris2.9
GCC target triplet: i386-pc-solaris2.9


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libfortran/25370] Bad value for sqrt of double complex
  2005-12-12 15:28 [Bug libfortran/25370] New: Bad value for sqrt of double complex fxcoudert at gcc dot gnu dot org
@ 2005-12-12 15:43 ` fxcoudert at gcc dot gnu dot org
  2005-12-12 20:06 ` kargl at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-12-12 15:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from fxcoudert at gcc dot gnu dot org  2005-12-12 15:43 -------
More info: when linked dynamically, the csqrt() function called is the
libgfortran one ([1] csqrt(z = <bad address 0x8071f56>), line 708 in
"c99_functions.c") which gives bad results.

When linked statically, I don't know what happens, but the csqrt() called
doesn't have no debug info (says dbx), which probably means it isn't the
libgfortran one. Amazing, since libgfortran/config.h does not define
HAVE_CSQRT...


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libfortran/25370] Bad value for sqrt of double complex
  2005-12-12 15:28 [Bug libfortran/25370] New: Bad value for sqrt of double complex fxcoudert at gcc dot gnu dot org
  2005-12-12 15:43 ` [Bug libfortran/25370] " fxcoudert at gcc dot gnu dot org
@ 2005-12-12 20:06 ` kargl at gcc dot gnu dot org
  2005-12-12 22:14 ` fxcoudert at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: kargl at gcc dot gnu dot org @ 2005-12-12 20:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from kargl at gcc dot gnu dot org  2005-12-12 20:06 -------
I don't see this problem on FreeBSD with either static of dynamic
linking.  Note, in both cases, I am picking up csqrt() from libgfortran.
What platform are you using?  Is this another glibc problem?  Does
-fdump-tree-original give expected output?


-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libfortran/25370] Bad value for sqrt of double complex
  2005-12-12 15:28 [Bug libfortran/25370] New: Bad value for sqrt of double complex fxcoudert at gcc dot gnu dot org
  2005-12-12 15:43 ` [Bug libfortran/25370] " fxcoudert at gcc dot gnu dot org
  2005-12-12 20:06 ` kargl at gcc dot gnu dot org
@ 2005-12-12 22:14 ` fxcoudert at gcc dot gnu dot org
  2005-12-15  9:25 ` fxcoudert at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-12-12 22:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from fxcoudert at gcc dot gnu dot org  2005-12-12 22:14 -------
(In reply to comment #2)
> I don't see this problem on FreeBSD with either static of dynamic
> linking.  Note, in both cases, I am picking up csqrt() from libgfortran.
> What platform are you using?

It's mentionned in the PR: i386-solaris2.9. I'll try to get some more debug
info.


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libfortran/25370] Bad value for sqrt of double complex
  2005-12-12 15:28 [Bug libfortran/25370] New: Bad value for sqrt of double complex fxcoudert at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-12-12 22:14 ` fxcoudert at gcc dot gnu dot org
@ 2005-12-15  9:25 ` fxcoudert at gcc dot gnu dot org
  2006-04-03  6:51 ` jvdelisle at gcc dot gnu dot org
  2006-04-22 20:39 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-12-15  9:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from fxcoudert at gcc dot gnu dot org  2005-12-15 09:25 -------
Adding a printf into the libgfortran csqrt() code:

  re = REALPART (z);
  im = IMAGPART (z);
  printf ("input: %lg %lg\n", re, im);

shows that it is used in both cases, but the input value is crap in the
dynamically-linked case:

$ ./bin/gfortran -static foo.f90 && ./a.out
 ( -1.000000    ,  0.000000    ) (  0.000000    ,  1.000000    )
input: -1 0
 ( -1.00000000000000     ,  0.00000000000000     ) (  0.00000000000000     , 
1.00000000000000     )
$ ./bin/gfortran foo.f90 && ./a.out
 ( -1.000000    ,  0.000000    ) (  0.000000    ,  1.000000    )
input: 6.64573e-316 1.59098e-314
 ( -1.00000000000000     ,  0.00000000000000     ) ( 1.397677071793657E-312,
3.756040694101013E-317)


I don't know what happens here!


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libfortran/25370] Bad value for sqrt of double complex
  2005-12-12 15:28 [Bug libfortran/25370] New: Bad value for sqrt of double complex fxcoudert at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-12-15  9:25 ` fxcoudert at gcc dot gnu dot org
@ 2006-04-03  6:51 ` jvdelisle at gcc dot gnu dot org
  2006-04-22 20:39 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-04-03  6:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jvdelisle at gcc dot gnu dot org  2006-04-03 06:51 -------
Recently updated glibc on my i686-pc-linux-gnu box and csqrt is now working.


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libfortran/25370] Bad value for sqrt of double complex
  2005-12-12 15:28 [Bug libfortran/25370] New: Bad value for sqrt of double complex fxcoudert at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-04-03  6:51 ` jvdelisle at gcc dot gnu dot org
@ 2006-04-22 20:39 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-22 20:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2006-04-22 20:39 -------
THis is not a libgfortran bug but rather a bug in the libm on your system.  The
libgfortran version of csqrt was fixed and works.  Glibc's version was also
fixed at the same time.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WORKSFORME


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-04-22 20:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-12 15:28 [Bug libfortran/25370] New: Bad value for sqrt of double complex fxcoudert at gcc dot gnu dot org
2005-12-12 15:43 ` [Bug libfortran/25370] " fxcoudert at gcc dot gnu dot org
2005-12-12 20:06 ` kargl at gcc dot gnu dot org
2005-12-12 22:14 ` fxcoudert at gcc dot gnu dot org
2005-12-15  9:25 ` fxcoudert at gcc dot gnu dot org
2006-04-03  6:51 ` jvdelisle at gcc dot gnu dot org
2006-04-22 20:39 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).