public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime
@ 2020-12-08 14:44 pozar at ecs dot umass.edu
  2020-12-08 15:34 ` [Bug fortran/98201] " tkoenig at gcc dot gnu.org
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: pozar at ecs dot umass.edu @ 2020-12-08 14:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

            Bug ID: 98201
           Summary: CSQRT function gives bad resuts at runtime
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pozar at ecs dot umass.edu
  Target Milestone: ---

I am running mingw gfortran 9.2.0 on Windows 7, and have a problem with results
from the CSQRT function during runtime. Sample code below, with results.
Starting with a complex argument having increasingly large real part, and a
relatively small imaginary part, csqrt initially gives a correct result (as
tested by squaring the result from CSQRT). But the second row shows some
significant error, and later rows show 'Infinity' for the imaginary part.
(using sq = z**.5 gives correct results)


F95 CODE;

! test CSQRT
    complex z, sq
    write(6,*) "         Argument                SquareRoot               SR
squared"
    do n=1,9
        z=-10.**n+(0.,.1)
        sq=csqrt(z)
        write(*,1) z, sq, sq*sq
    end do
1   format(3("(",e10.4,2x,e10.4,")",3x))
pause

RESULTS:
          Argument                  SquareRoot               SR squared
(-.1000E+02  0.1000E+00)   (0.1581E-01  0.3163E+01)   (-.1001E+02  0.1000E+00)
(-.1000E+03  0.1000E+00)   (0.5167E-02  0.9676E+01)   (-.9362E+02  0.1000E+00)
(-.1000E+04  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
(-.1000E+05  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
(-.1000E+06  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
(-.1000E+07  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
(-.1000E+08  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
(-.1000E+09  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
(-.1000E+10  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
PAUSE

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
@ 2020-12-08 15:34 ` tkoenig at gcc dot gnu.org
  2020-12-08 15:35 ` dominiq at lps dot ens.fr
                   ` (18 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-12-08 15:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |mingw
                 CC|                            |tkoenig at gcc dot gnu.org

--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Here is a slight extension of your program, which also
checks the compile-time simplification. Can you tell me
what it does?

program main
  implicit none
  integer :: i,n
  complex z, sq
  complex, parameter, dimension(9) :: zp = [(-10.**i+(0.,1.),i=1,9)]
  complex, parameter, dimension(9) :: sqp = sqrt(zp)
  write (*,*) "Runtime"
  write (*,*) "         Argument                SquareRoot               SR
squared"
  do n=1,9
     z=-10.**n+(0.,.1)
     sq=csqrt(z)
     write(*,1) z, sq, sq*sq
  end do
  write (*,*) "Compile-time"
  do n=1,9
    write (*,1) zp(n), sqp(n), sqp(n)**2
  end do
1 format(3("(",e10.4,2x,e10.4,")",3x))
end

On my Linux box, it prints

 Runtime
          Argument                SquareRoot               SR squared
(-.1000E+02  0.1000E+00)   (0.1581E-01  0.3162E+01)   (-.1000E+02  0.1000E+00)
(-.1000E+03  0.1000E+00)   (0.5000E-02  0.1000E+02)   (-.1000E+03  0.1000E+00)
(-.1000E+04  0.1000E+00)   (0.1581E-02  0.3162E+02)   (-.1000E+04  0.1000E+00)
(-.1000E+05  0.1000E+00)   (0.5000E-03  0.1000E+03)   (-.1000E+05  0.1000E+00)
(-.1000E+06  0.1000E+00)   (0.1581E-03  0.3162E+03)   (-.1000E+06  0.1000E+00)
(-.1000E+07  0.1000E+00)   (0.5000E-04  0.1000E+04)   (-.1000E+07  0.1000E+00)
(-.1000E+08  0.1000E+00)   (0.1581E-04  0.3162E+04)   (-.1000E+08  0.1000E+00)
(-.1000E+09  0.1000E+00)   (0.5000E-05  0.1000E+05)   (-.1000E+09  0.1000E+00)
(-.1000E+10  0.1000E+00)   (0.1581E-05  0.3162E+05)   (-.1000E+10  0.1000E+00)
 Compile-time
(-.1000E+02  0.1000E+01)   (0.1579E+00  0.3166E+01)   (-.1000E+02  0.1000E+01)
(-.1000E+03  0.1000E+01)   (0.5000E-01  0.1000E+02)   (-.1000E+03  0.1000E+01)
(-.1000E+04  0.1000E+01)   (0.1581E-01  0.3162E+02)   (-.1000E+04  0.1000E+01)
(-.1000E+05  0.1000E+01)   (0.5000E-02  0.1000E+03)   (-.1000E+05  0.1000E+01)
(-.1000E+06  0.1000E+01)   (0.1581E-02  0.3162E+03)   (-.1000E+06  0.1000E+01)
(-.1000E+07  0.1000E+01)   (0.5000E-03  0.1000E+04)   (-.1000E+07  0.1000E+01)
(-.1000E+08  0.1000E+01)   (0.1581E-03  0.3162E+04)   (-.1000E+08  0.1000E+01)
(-.1000E+09  0.1000E+01)   (0.5000E-04  0.1000E+05)   (-.1000E+09  0.1000E+01)
(-.1000E+10  0.1000E+01)   (0.1581E-04  0.3162E+05)   (-.1000E+10  0.1000E+01)

so there is a slight difference in one value, but nothing as
completely wrong as what you show.

What is the output of that program on your system?

And what is the output of "gfortran -v" ?

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
  2020-12-08 15:34 ` [Bug fortran/98201] " tkoenig at gcc dot gnu.org
@ 2020-12-08 15:35 ` dominiq at lps dot ens.fr
  2020-12-08 15:47 ` dpozar at ecs dot umass.edu
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-12-08 15:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-12-08
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
WORKSFORME on Darwin.

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
  2020-12-08 15:34 ` [Bug fortran/98201] " tkoenig at gcc dot gnu.org
  2020-12-08 15:35 ` dominiq at lps dot ens.fr
@ 2020-12-08 15:47 ` dpozar at ecs dot umass.edu
  2020-12-08 15:54 ` dpozar at ecs dot umass.edu
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: dpozar at ecs dot umass.edu @ 2020-12-08 15:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #3 from dpozar at ecs dot umass.edu ---
Thomas,

compile time works fine; runtime not so good.
dave

Output below:
 Runtime
          Argument                         SquareRoot                          
   SR squared
(-.1000E+02  0.1000E+00)   (0.1581E-01  0.3163E+01)   (-.1001E+02  0.1000E+00)
(-.1000E+03  0.1000E+00)   (0.5167E-02  0.9676E+01)   (-.9362E+02  0.1000E+00)
(-.1000E+04  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
(-.1000E+05  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
(-.1000E+06  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
(-.1000E+07  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
(-.1000E+08  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
(-.1000E+09  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
(-.1000E+10  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
 Compile-time
(-.1000E+02  0.1000E+01)   (0.1579E+00  0.3166E+01)   (-.1000E+02  0.1000E+01)
(-.1000E+03  0.1000E+01)   (0.5000E-01  0.1000E+02)   (-.1000E+03  0.1000E+01)
(-.1000E+04  0.1000E+01)   (0.1581E-01  0.3162E+02)   (-.1000E+04  0.1000E+01)
(-.1000E+05  0.1000E+01)   (0.5000E-02  0.1000E+03)   (-.1000E+05  0.1000E+01)
(-.1000E+06  0.1000E+01)   (0.1581E-02  0.3162E+03)   (-.1000E+06  0.1000E+01)
(-.1000E+07  0.1000E+01)   (0.5000E-03  0.1000E+04)   (-.1000E+07  0.1000E+01)
(-.1000E+08  0.1000E+01)   (0.1581E-03  0.3162E+04)   (-.1000E+08  0.1000E+01)
(-.1000E+09  0.1000E+01)   (0.5000E-04  0.1000E+05)   (-.1000E+09  0.1000E+01)
(-.1000E+10  0.1000E+01)   (0.1581E-04  0.3162E+05)   (-.1000E+10  0.1000E+01)

Process returned 0 (0x0)   execution time : 0.060 s
Press any key to continue.


________________________________
From: tkoenig at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
Sent: Tuesday, December 8, 2020 10:34 AM
To: David Pozar <dpozar@ecs.umass.edu>
Subject: [Bug fortran/98201] CSQRT function gives bad resuts at runtime

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |mingw
                 CC|                            |tkoenig at gcc dot gnu.org

--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Here is a slight extension of your program, which also
checks the compile-time simplification. Can you tell me
what it does?

program main
  implicit none
  integer :: i,n
  complex z, sq
  complex, parameter, dimension(9) :: zp = [(-10.**i+(0.,1.),i=1,9)]
  complex, parameter, dimension(9) :: sqp = sqrt(zp)
  write (*,*) "Runtime"
  write (*,*) "         Argument                SquareRoot               SR
squared"
  do n=1,9
     z=-10.**n+(0.,.1)
     sq=csqrt(z)
     write(*,1) z, sq, sq*sq
  end do
  write (*,*) "Compile-time"
  do n=1,9
    write (*,1) zp(n), sqp(n), sqp(n)**2
  end do
1 format(3("(",e10.4,2x,e10.4,")",3x))
end

On my Linux box, it prints

 Runtime
          Argument                SquareRoot               SR squared
(-.1000E+02  0.1000E+00)   (0.1581E-01  0.3162E+01)   (-.1000E+02  0.1000E+00)
(-.1000E+03  0.1000E+00)   (0.5000E-02  0.1000E+02)   (-.1000E+03  0.1000E+00)
(-.1000E+04  0.1000E+00)   (0.1581E-02  0.3162E+02)   (-.1000E+04  0.1000E+00)
(-.1000E+05  0.1000E+00)   (0.5000E-03  0.1000E+03)   (-.1000E+05  0.1000E+00)
(-.1000E+06  0.1000E+00)   (0.1581E-03  0.3162E+03)   (-.1000E+06  0.1000E+00)
(-.1000E+07  0.1000E+00)   (0.5000E-04  0.1000E+04)   (-.1000E+07  0.1000E+00)
(-.1000E+08  0.1000E+00)   (0.1581E-04  0.3162E+04)   (-.1000E+08  0.1000E+00)
(-.1000E+09  0.1000E+00)   (0.5000E-05  0.1000E+05)   (-.1000E+09  0.1000E+00)
(-.1000E+10  0.1000E+00)   (0.1581E-05  0.3162E+05)   (-.1000E+10  0.1000E+00)
 Compile-time
(-.1000E+02  0.1000E+01)   (0.1579E+00  0.3166E+01)   (-.1000E+02  0.1000E+01)
(-.1000E+03  0.1000E+01)   (0.5000E-01  0.1000E+02)   (-.1000E+03  0.1000E+01)
(-.1000E+04  0.1000E+01)   (0.1581E-01  0.3162E+02)   (-.1000E+04  0.1000E+01)
(-.1000E+05  0.1000E+01)   (0.5000E-02  0.1000E+03)   (-.1000E+05  0.1000E+01)
(-.1000E+06  0.1000E+01)   (0.1581E-02  0.3162E+03)   (-.1000E+06  0.1000E+01)
(-.1000E+07  0.1000E+01)   (0.5000E-03  0.1000E+04)   (-.1000E+07  0.1000E+01)
(-.1000E+08  0.1000E+01)   (0.1581E-03  0.3162E+04)   (-.1000E+08  0.1000E+01)
(-.1000E+09  0.1000E+01)   (0.5000E-04  0.1000E+05)   (-.1000E+09  0.1000E+01)
(-.1000E+10  0.1000E+01)   (0.1581E-04  0.3162E+05)   (-.1000E+10  0.1000E+01)

so there is a slight difference in one value, but nothing as
completely wrong as what you show.

What is the output of that program on your system?

And what is the output of "gfortran -v" ?

--
You are receiving this mail because:
You reported the bug.

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
                   ` (2 preceding siblings ...)
  2020-12-08 15:47 ` dpozar at ecs dot umass.edu
@ 2020-12-08 15:54 ` dpozar at ecs dot umass.edu
  2020-12-08 15:55 ` tkoenig at gcc dot gnu.org
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: dpozar at ecs dot umass.edu @ 2020-12-08 15:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #4 from dpozar at ecs dot umass.edu ---
Thomas,

the output for gfortran -v is:

c:\MinGW>gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/9.2.0/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-9.2.0/configure --build=x86_64-pc-linux-gnu
--host=m
ingw32 --target=mingw32 --disable-win32-registry --with-arch=i586
--with-tune=ge
neric --enable-static --enable-shared --enable-threads
--enable-languages=c,c++,
objc,obj-c++,fortran,ada --with-dwarf2 --disable-sjlj-exceptions
--enable-versio
n-specific-runtime-libs --enable-libgomp --disable-libvtv
--with-libiconv-prefix
=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug
--disable-build-fo
rmat-warnings --prefix=/mingw --with-gmp=/mingw --with-mpfr=/mingw
--with-mpc=/m
ingw --with-isl=/mingw --enable-nls --with-pkgversion='MinGW.org GCC Build-2'
Thread model: win32
gcc version 9.2.0 (MinGW.org GCC Build-2)

c:\MinGW>
________________________________
From: tkoenig at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
Sent: Tuesday, December 8, 2020 10:34 AM
To: David Pozar <dpozar@ecs.umass.edu>
Subject: [Bug fortran/98201] CSQRT function gives bad resuts at runtime

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |mingw
                 CC|                            |tkoenig at gcc dot gnu.org

--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Here is a slight extension of your program, which also
checks the compile-time simplification. Can you tell me
what it does?

program main
  implicit none
  integer :: i,n
  complex z, sq
  complex, parameter, dimension(9) :: zp = [(-10.**i+(0.,1.),i=1,9)]
  complex, parameter, dimension(9) :: sqp = sqrt(zp)
  write (*,*) "Runtime"
  write (*,*) "         Argument                SquareRoot               SR
squared"
  do n=1,9
     z=-10.**n+(0.,.1)
     sq=csqrt(z)
     write(*,1) z, sq, sq*sq
  end do
  write (*,*) "Compile-time"
  do n=1,9
    write (*,1) zp(n), sqp(n), sqp(n)**2
  end do
1 format(3("(",e10.4,2x,e10.4,")",3x))
end

On my Linux box, it prints

 Runtime
          Argument                SquareRoot               SR squared
(-.1000E+02  0.1000E+00)   (0.1581E-01  0.3162E+01)   (-.1000E+02  0.1000E+00)
(-.1000E+03  0.1000E+00)   (0.5000E-02  0.1000E+02)   (-.1000E+03  0.1000E+00)
(-.1000E+04  0.1000E+00)   (0.1581E-02  0.3162E+02)   (-.1000E+04  0.1000E+00)
(-.1000E+05  0.1000E+00)   (0.5000E-03  0.1000E+03)   (-.1000E+05  0.1000E+00)
(-.1000E+06  0.1000E+00)   (0.1581E-03  0.3162E+03)   (-.1000E+06  0.1000E+00)
(-.1000E+07  0.1000E+00)   (0.5000E-04  0.1000E+04)   (-.1000E+07  0.1000E+00)
(-.1000E+08  0.1000E+00)   (0.1581E-04  0.3162E+04)   (-.1000E+08  0.1000E+00)
(-.1000E+09  0.1000E+00)   (0.5000E-05  0.1000E+05)   (-.1000E+09  0.1000E+00)
(-.1000E+10  0.1000E+00)   (0.1581E-05  0.3162E+05)   (-.1000E+10  0.1000E+00)
 Compile-time
(-.1000E+02  0.1000E+01)   (0.1579E+00  0.3166E+01)   (-.1000E+02  0.1000E+01)
(-.1000E+03  0.1000E+01)   (0.5000E-01  0.1000E+02)   (-.1000E+03  0.1000E+01)
(-.1000E+04  0.1000E+01)   (0.1581E-01  0.3162E+02)   (-.1000E+04  0.1000E+01)
(-.1000E+05  0.1000E+01)   (0.5000E-02  0.1000E+03)   (-.1000E+05  0.1000E+01)
(-.1000E+06  0.1000E+01)   (0.1581E-02  0.3162E+03)   (-.1000E+06  0.1000E+01)
(-.1000E+07  0.1000E+01)   (0.5000E-03  0.1000E+04)   (-.1000E+07  0.1000E+01)
(-.1000E+08  0.1000E+01)   (0.1581E-03  0.3162E+04)   (-.1000E+08  0.1000E+01)
(-.1000E+09  0.1000E+01)   (0.5000E-04  0.1000E+05)   (-.1000E+09  0.1000E+01)
(-.1000E+10  0.1000E+01)   (0.1581E-04  0.3162E+05)   (-.1000E+10  0.1000E+01)

so there is a slight difference in one value, but nothing as
completely wrong as what you show.

What is the output of that program on your system?

And what is the output of "gfortran -v" ?

--
You are receiving this mail because:
You reported the bug.

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
                   ` (3 preceding siblings ...)
  2020-12-08 15:54 ` dpozar at ecs dot umass.edu
@ 2020-12-08 15:55 ` tkoenig at gcc dot gnu.org
  2020-12-08 16:27 ` dpozar at ecs dot umass.edu
                   ` (14 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-12-08 15:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
What is the output of

#include <complex.h>
#include <stdio.h>

int main()
{
  _Complex float z, sq, sq2;
  int n;
  float a;
  a = -1.;
  for (n = 1; n < 10; n++)
    {
      a = a * 10;
      z = a + _Complex_I * 1.0;
      sq = csqrtf (z);
      sq2 = sq * sq;
      printf ("(%e,%e) (%e,%e) (%e,%e)\n", creal(z), cimag(z),
              creal(sq), cimag(sq), creal(sq2), cimag(sq2));
    }
  return 0;
}

?

On my Linux box, it is

(-1.000000e+01,1.000000e+00) (1.579171e-01,3.166218e+00)
(-1.000000e+01,1.000000e+00)
(-1.000000e+02,1.000000e+00) (4.999937e-02,1.000012e+01)
(-1.000000e+02,1.000000e+00)
(-1.000000e+03,1.000000e+00) (1.581139e-02,3.162278e+01)
(-9.999999e+02,1.000000e+00)
(-1.000000e+04,1.000000e+00) (5.000000e-03,1.000000e+02)
(-1.000000e+04,1.000000e+00)
(-1.000000e+05,1.000000e+00) (1.581139e-03,3.162278e+02)
(-9.999999e+04,1.000000e+00)
(-1.000000e+06,1.000000e+00) (5.000000e-04,1.000000e+03)
(-1.000000e+06,1.000000e+00)
(-1.000000e+07,1.000000e+00) (1.581139e-04,3.162278e+03)
(-1.000000e+07,1.000000e+00)
(-1.000000e+08,1.000000e+00) (5.000000e-05,1.000000e+04)
(-1.000000e+08,1.000000e+00)
(-1.000000e+09,1.000000e+00) (1.581139e-05,3.162278e+04)
(-1.000000e+09,9.999999e-01)

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
                   ` (4 preceding siblings ...)
  2020-12-08 15:55 ` tkoenig at gcc dot gnu.org
@ 2020-12-08 16:27 ` dpozar at ecs dot umass.edu
  2020-12-08 17:36 ` kargl at gcc dot gnu.org
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: dpozar at ecs dot umass.edu @ 2020-12-08 16:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #6 from dpozar at ecs dot umass.edu ---
Thomas,
I am running that code in code blocks with MS visual C++ 2010, but I can't find
the output - no console screen, and no output file that I can find.

dave
________________________________
From: tkoenig at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
Sent: Tuesday, December 8, 2020 10:55 AM
To: David Pozar <dpozar@ecs.umass.edu>
Subject: [Bug fortran/98201] CSQRT function gives bad resuts at runtime

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
What is the output of

#include <complex.h>
#include <stdio.h>

int main()
{
  _Complex float z, sq, sq2;
  int n;
  float a;
  a = -1.;
  for (n = 1; n < 10; n++)
    {
      a = a * 10;
      z = a + _Complex_I * 1.0;
      sq = csqrtf (z);
      sq2 = sq * sq;
      printf ("(%e,%e) (%e,%e) (%e,%e)\n", creal(z), cimag(z),
              creal(sq), cimag(sq), creal(sq2), cimag(sq2));
    }
  return 0;
}

?

On my Linux box, it is

(-1.000000e+01,1.000000e+00) (1.579171e-01,3.166218e+00)
(-1.000000e+01,1.000000e+00)
(-1.000000e+02,1.000000e+00) (4.999937e-02,1.000012e+01)
(-1.000000e+02,1.000000e+00)
(-1.000000e+03,1.000000e+00) (1.581139e-02,3.162278e+01)
(-9.999999e+02,1.000000e+00)
(-1.000000e+04,1.000000e+00) (5.000000e-03,1.000000e+02)
(-1.000000e+04,1.000000e+00)
(-1.000000e+05,1.000000e+00) (1.581139e-03,3.162278e+02)
(-9.999999e+04,1.000000e+00)
(-1.000000e+06,1.000000e+00) (5.000000e-04,1.000000e+03)
(-1.000000e+06,1.000000e+00)
(-1.000000e+07,1.000000e+00) (1.581139e-04,3.162278e+03)
(-1.000000e+07,1.000000e+00)
(-1.000000e+08,1.000000e+00) (5.000000e-05,1.000000e+04)
(-1.000000e+08,1.000000e+00)
(-1.000000e+09,1.000000e+00) (1.581139e-05,3.162278e+04)
(-1.000000e+09,9.999999e-01)

--
You are receiving this mail because:
You reported the bug.

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
                   ` (5 preceding siblings ...)
  2020-12-08 16:27 ` dpozar at ecs dot umass.edu
@ 2020-12-08 17:36 ` kargl at gcc dot gnu.org
  2020-12-08 18:19 ` tkoenig at gcc dot gnu.org
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: kargl at gcc dot gnu.org @ 2020-12-08 17:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

kargl at gcc dot gnu.org changed:

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

--- Comment #7 from kargl at gcc dot gnu.org ---
(In reply to dpozar from comment #3)
> Thomas,
> 
> compile time works fine; runtime not so good.
> dave
> 

So, maybe not a gfortran problem.

% gfcx -o z -fdump-tree-original a.f90
% grep csqrt a.f90.004t.original 
        sq = __builtin_csqrtf (z);
% nm z | grep sqrt
         U csqrtf@@FBSD_1.1

'sq = csqrt(z)' is compiled to 'sq = __builtin_csqrtf (z);' and
__builtin_csqrtf() is mapped to your math library's csqrtf()
function.  If your math library does not have csqrtf(), then 
there is a fall back function in libgfortran.  Looking at the
fallback function shows a design flaw.  Don't know if that you're
problem.

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
                   ` (6 preceding siblings ...)
  2020-12-08 17:36 ` kargl at gcc dot gnu.org
@ 2020-12-08 18:19 ` tkoenig at gcc dot gnu.org
  2020-12-08 19:13 ` dpozar at ecs dot umass.edu
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-12-08 18:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #8 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to dpozar from comment #6)
> Thomas,
> I am running that code in code blocks with MS visual C++ 2010, but I can't
> find the output - no console screen, and no output file that I can find.

What if you use gcc to compile this code, same as with gfortran?

And am I right in assuming (from the output of gfortran -v) that
you are using 32-bit gfortran?  (And why?)

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
                   ` (7 preceding siblings ...)
  2020-12-08 18:19 ` tkoenig at gcc dot gnu.org
@ 2020-12-08 19:13 ` dpozar at ecs dot umass.edu
  2020-12-08 19:27 ` tkoenig at gcc dot gnu.org
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: dpozar at ecs dot umass.edu @ 2020-12-08 19:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #9 from dpozar at ecs dot umass.edu ---
Thomas,

when I run your code with gcc from command line, I still do not see any output
(no errors, but no output). Tried with both c and c++. I am not an expert at C,
and actually I don't think I have used MinGW with C before.

as far as Mingw32 - that was the only option I saw at sourceforge when I
downloaded it. But I would think that either version should work.

thanks,
dave
________________________________
From: tkoenig at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
Sent: Tuesday, December 8, 2020 1:19 PM
To: David Pozar <dpozar@ecs.umass.edu>
Subject: [Bug fortran/98201] CSQRT function gives bad resuts at runtime

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #8 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to dpozar from comment #6)
> Thomas,
> I am running that code in code blocks with MS visual C++ 2010, but I can't
> find the output - no console screen, and no output file that I can find.

What if you use gcc to compile this code, same as with gfortran?

And am I right in assuming (from the output of gfortran -v) that
you are using 32-bit gfortran?  (And why?)

--
You are receiving this mail because:
You reported the bug.

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
                   ` (8 preceding siblings ...)
  2020-12-08 19:13 ` dpozar at ecs dot umass.edu
@ 2020-12-08 19:27 ` tkoenig at gcc dot gnu.org
  2020-12-08 20:46 ` dpozar at ecs dot umass.edu
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-12-08 19:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #10 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
I don't have a working mingw system myself, but I dusted off my cygwin
system for this, using their cross-compiler to mingw.

With

$ x86_64-w64-mingw32-gfortran.exe -static -static-libgfortran csqrt.f90

this gave

          Argument                SquareRoot               SR squared
(-.1000E+02  0.1000E+00)   (0.1581E-01  0.3162E+01)   (-.1000E+02  0.1000E+00)
(-.1000E+03  0.1000E+00)   (0.5000E-02  0.1000E+02)   (-.1000E+03  0.1000E+00)
(-.1000E+04  0.1000E+00)   (0.1581E-02  0.3162E+02)   (-.1000E+04  0.1000E+00)
(-.1000E+05  0.1000E+00)   (0.5000E-03  0.1000E+03)   (-.1000E+05  0.1000E+00)
(-.1000E+06  0.1000E+00)   (0.1581E-03  0.3162E+03)   (-.1000E+06  0.1000E+00)
(-.1000E+07  0.1000E+00)   (0.5000E-04  0.1000E+04)   (-.1000E+07  0.1000E+00)
(-.1000E+08  0.1000E+00)   (0.1581E-04  0.3162E+04)   (-.1000E+08  0.1000E+00)
(-.1000E+09  0.1000E+00)   (0.5000E-05  0.1000E+05)   (-.1000E+09  0.1000E+00)
(-.1000E+10  0.1000E+00)   (0.1581E-05  0.3162E+05)   (-.1000E+10  0.1000E+00)

which is OK (I tried the program both from the cygwin command line and
the cmd prompt).

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
                   ` (9 preceding siblings ...)
  2020-12-08 19:27 ` tkoenig at gcc dot gnu.org
@ 2020-12-08 20:46 ` dpozar at ecs dot umass.edu
  2020-12-08 22:06 ` kargl at gcc dot gnu.org
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: dpozar at ecs dot umass.edu @ 2020-12-08 20:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #11 from dpozar at ecs dot umass.edu ---
Thomas,

that looks good. But I am not sure how to proceed ...

dave
________________________________
From: tkoenig at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
Sent: Tuesday, December 8, 2020 2:27 PM
To: David Pozar <dpozar@ecs.umass.edu>
Subject: [Bug fortran/98201] CSQRT function gives bad resuts at runtime

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #10 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
I don't have a working mingw system myself, but I dusted off my cygwin
system for this, using their cross-compiler to mingw.

With

$ x86_64-w64-mingw32-gfortran.exe -static -static-libgfortran csqrt.f90

this gave

          Argument                SquareRoot               SR squared
(-.1000E+02  0.1000E+00)   (0.1581E-01  0.3162E+01)   (-.1000E+02  0.1000E+00)
(-.1000E+03  0.1000E+00)   (0.5000E-02  0.1000E+02)   (-.1000E+03  0.1000E+00)
(-.1000E+04  0.1000E+00)   (0.1581E-02  0.3162E+02)   (-.1000E+04  0.1000E+00)
(-.1000E+05  0.1000E+00)   (0.5000E-03  0.1000E+03)   (-.1000E+05  0.1000E+00)
(-.1000E+06  0.1000E+00)   (0.1581E-03  0.3162E+03)   (-.1000E+06  0.1000E+00)
(-.1000E+07  0.1000E+00)   (0.5000E-04  0.1000E+04)   (-.1000E+07  0.1000E+00)
(-.1000E+08  0.1000E+00)   (0.1581E-04  0.3162E+04)   (-.1000E+08  0.1000E+00)
(-.1000E+09  0.1000E+00)   (0.5000E-05  0.1000E+05)   (-.1000E+09  0.1000E+00)
(-.1000E+10  0.1000E+00)   (0.1581E-05  0.3162E+05)   (-.1000E+10  0.1000E+00)

which is OK (I tried the program both from the cygwin command line and
the cmd prompt).

--
You are receiving this mail because:
You reported the bug.

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
                   ` (10 preceding siblings ...)
  2020-12-08 20:46 ` dpozar at ecs dot umass.edu
@ 2020-12-08 22:06 ` kargl at gcc dot gnu.org
  2020-12-09  0:28 ` dpozar at ecs dot umass.edu
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: kargl at gcc dot gnu.org @ 2020-12-08 22:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #12 from kargl at gcc dot gnu.org ---
(In reply to dpozar from comment #11)
> Thomas,
> 
> that looks good. But I am not sure how to proceed ...
> 
> dave

Well, the first thing to do is to use either nm or objdump on the
executable created from the code in comment #1 to determine where
csqrtf() lives.

If csqrtf() is from a Microsoft library, then we're done here and
you need to contact Microsoft.

If csqrtf() is from MingW's libm.a (or libm.so), then we're done
here and you need to contact MingW.

If csqrtf() is from libgfortran.a (or libgfortran.so), then you'll
need to look at gcc/libgfortran/intrinsics/c99_functions.c.

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
                   ` (11 preceding siblings ...)
  2020-12-08 22:06 ` kargl at gcc dot gnu.org
@ 2020-12-09  0:28 ` dpozar at ecs dot umass.edu
  2020-12-09  4:38 ` sgk at troutmask dot apl.washington.edu
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: dpozar at ecs dot umass.edu @ 2020-12-09  0:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #13 from dpozar at ecs dot umass.edu ---
Ok, I have objdump, and the .exe file. What switch options do I need to use in
objdump?

thanks
________________________________
From: kargl at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
Sent: Tuesday, December 8, 2020 5:06 PM
To: David Pozar <dpozar@ecs.umass.edu>
Subject: [Bug fortran/98201] CSQRT function gives bad resuts at runtime

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #12 from kargl at gcc dot gnu.org ---
(In reply to dpozar from comment #11)
> Thomas,
>
> that looks good. But I am not sure how to proceed ...
>
> dave

Well, the first thing to do is to use either nm or objdump on the
executable created from the code in comment #1 to determine where
csqrtf() lives.

If csqrtf() is from a Microsoft library, then we're done here and
you need to contact Microsoft.

If csqrtf() is from MingW's libm.a (or libm.so), then we're done
here and you need to contact MingW.

If csqrtf() is from libgfortran.a (or libgfortran.so), then you'll
need to look at gcc/libgfortran/intrinsics/c99_functions.c.

--
You are receiving this mail because:
You reported the bug.

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
                   ` (12 preceding siblings ...)
  2020-12-09  0:28 ` dpozar at ecs dot umass.edu
@ 2020-12-09  4:38 ` sgk at troutmask dot apl.washington.edu
  2020-12-09 13:24 ` dpozar at ecs dot umass.edu
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2020-12-09  4:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #14 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Wed, Dec 09, 2020 at 12:28:49AM +0000, dpozar at ecs dot umass.edu wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201
> 
> --- Comment #13 from dpozar at ecs dot umass.edu ---
> Ok, I have objdump, and the .exe file. What switch options do I need to use in
> objdump?
> 

Don't use windows, so only guessing.

cmd> objdump -t name_of_file.exe

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
                   ` (13 preceding siblings ...)
  2020-12-09  4:38 ` sgk at troutmask dot apl.washington.edu
@ 2020-12-09 13:24 ` dpozar at ecs dot umass.edu
  2020-12-09 15:37 ` sgk at troutmask dot apl.washington.edu
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: dpozar at ecs dot umass.edu @ 2020-12-09 13:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #15 from dpozar at ecs dot umass.edu ---
attached is the output file from

c:\MinGW>objdump -t c:\mingw\programs\testcsqrt.exe >cmdout.txt

don't see any reference to libraries, though.

thanks,
dave
________________________________
From: sgk at troutmask dot apl.washington.edu <gcc-bugzilla@gcc.gnu.org>
Sent: Tuesday, December 8, 2020 11:38 PM
To: David Pozar <dpozar@ecs.umass.edu>
Subject: [Bug fortran/98201] CSQRT function gives bad resuts at runtime

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #14 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Wed, Dec 09, 2020 at 12:28:49AM +0000, dpozar at ecs dot umass.edu wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201
>
> --- Comment #13 from dpozar at ecs dot umass.edu ---
> Ok, I have objdump, and the .exe file. What switch options do I need to use in
> objdump?
>

Don't use windows, so only guessing.

cmd> objdump -t name_of_file.exe

--
You are receiving this mail because:
You reported the bug.

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
                   ` (14 preceding siblings ...)
  2020-12-09 13:24 ` dpozar at ecs dot umass.edu
@ 2020-12-09 15:37 ` sgk at troutmask dot apl.washington.edu
  2020-12-09 16:04 ` dpozar at ecs dot umass.edu
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2020-12-09 15:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #16 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Wed, Dec 09, 2020 at 01:24:20PM +0000, dpozar at ecs dot umass.edu wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201
> 
> --- Comment #15 from dpozar at ecs dot umass.edu ---
> attached is the output file from
> 
> c:\MinGW>objdump -t c:\mingw\programs\testcsqrt.exe >cmdout.txt
> 
> don't see any reference to libraries, though.
> 

Is testcsqrt.exe compiled with the -static option?  cmdout.txt
shows

[152](sec  1)(fl 0x00)(ty  20)(scl   2) (nx 1) 0x00001210 _csqrtf
AUX tagndx 0 ttlsiz 0x0 lnnos 0 next 0

On my FreeBSD system and a static binary, I see 

% gfcx -o z -static a.f90
% objdump -t z | grep csqrt
00000000 l    df *ABS*  00000000 s_csqrtf.c
08078a90 g     F .text  0000021d csqrtf

On my FreeBSD system and a dynamic binary, I see

% gfcx -o z a.f90
% objdump -t z | grep csqrt
00000000       F *UND*  00000000              csqrtf@@FBSD_1.1

This info is sufficient to tell me that csqrtf lives in FreeBSD's libm.

objdump has several options that may help determine where
csqrtf() resides.   I don't know MingW (or windows 10) to
be of any additional help.

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
                   ` (15 preceding siblings ...)
  2020-12-09 15:37 ` sgk at troutmask dot apl.washington.edu
@ 2020-12-09 16:04 ` dpozar at ecs dot umass.edu
  2021-03-28 12:38 ` dominiq at lps dot ens.fr
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: dpozar at ecs dot umass.edu @ 2020-12-09 16:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #17 from dpozar at ecs dot umass.edu ---
No, I don't think it is compiled with static option. I am using code blocks,
which does not seem to even allow a static option.
________________________________
From: sgk at troutmask dot apl.washington.edu <gcc-bugzilla@gcc.gnu.org>
Sent: Wednesday, December 9, 2020 10:37 AM
To: David Pozar <dpozar@ecs.umass.edu>
Subject: [Bug fortran/98201] CSQRT function gives bad resuts at runtime

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #16 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Wed, Dec 09, 2020 at 01:24:20PM +0000, dpozar at ecs dot umass.edu wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201
>
> --- Comment #15 from dpozar at ecs dot umass.edu ---
> attached is the output file from
>
> c:\MinGW>objdump -t c:\mingw\programs\testcsqrt.exe >cmdout.txt
>
> don't see any reference to libraries, though.
>

Is testcsqrt.exe compiled with the -static option?  cmdout.txt
shows

[152](sec  1)(fl 0x00)(ty  20)(scl   2) (nx 1) 0x00001210 _csqrtf
AUX tagndx 0 ttlsiz 0x0 lnnos 0 next 0

On my FreeBSD system and a static binary, I see

% gfcx -o z -static a.f90
% objdump -t z | grep csqrt
00000000 l    df *ABS*  00000000 s_csqrtf.c
08078a90 g     F .text  0000021d csqrtf

On my FreeBSD system and a dynamic binary, I see

% gfcx -o z a.f90
% objdump -t z | grep csqrt
00000000       F *UND*  00000000              csqrtf@@FBSD_1.1

This info is sufficient to tell me that csqrtf lives in FreeBSD's libm.

objdump has several options that may help determine where
csqrtf() resides.   I don't know MingW (or windows 10) to
be of any additional help.

--
You are receiving this mail because:
You reported the bug.

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
                   ` (16 preceding siblings ...)
  2020-12-09 16:04 ` dpozar at ecs dot umass.edu
@ 2021-03-28 12:38 ` dominiq at lps dot ens.fr
  2021-03-28 13:05 ` dpozar at ecs dot umass.edu
  2021-03-28 13:16 ` dominiq at lps dot ens.fr
  19 siblings, 0 replies; 21+ messages in thread
From: dominiq at lps dot ens.fr @ 2021-03-28 12:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #18 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Could this PR be closed or moved to target component?

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
                   ` (17 preceding siblings ...)
  2021-03-28 12:38 ` dominiq at lps dot ens.fr
@ 2021-03-28 13:05 ` dpozar at ecs dot umass.edu
  2021-03-28 13:16 ` dominiq at lps dot ens.fr
  19 siblings, 0 replies; 21+ messages in thread
From: dpozar at ecs dot umass.edu @ 2021-03-28 13:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #19 from dpozar at ecs dot umass.edu ---
I think it can be closed. never found out why this occurred, but I reloaded
gfortran from another source and it worked after that.

thanks,
dave
________________________________
From: dominiq at lps dot ens.fr <gcc-bugzilla@gcc.gnu.org>
Sent: Sunday, March 28, 2021 8:38 AM
To: David Pozar <dpozar@ecs.umass.edu>
Subject: [Bug fortran/98201] CSQRT function gives bad resuts at runtime

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #18 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Could this PR be closed or moved to target component?

--
You are receiving this mail because:
You reported the bug.

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

* [Bug fortran/98201] CSQRT function gives bad resuts at runtime
  2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
                   ` (18 preceding siblings ...)
  2021-03-28 13:05 ` dpozar at ecs dot umass.edu
@ 2021-03-28 13:16 ` dominiq at lps dot ens.fr
  19 siblings, 0 replies; 21+ messages in thread
From: dominiq at lps dot ens.fr @ 2021-03-28 13:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|WAITING                     |RESOLVED

--- Comment #20 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> I think it can be closed.

Thus closing.

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

end of thread, other threads:[~2021-03-28 13:16 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08 14:44 [Bug fortran/98201] New: CSQRT function gives bad resuts at runtime pozar at ecs dot umass.edu
2020-12-08 15:34 ` [Bug fortran/98201] " tkoenig at gcc dot gnu.org
2020-12-08 15:35 ` dominiq at lps dot ens.fr
2020-12-08 15:47 ` dpozar at ecs dot umass.edu
2020-12-08 15:54 ` dpozar at ecs dot umass.edu
2020-12-08 15:55 ` tkoenig at gcc dot gnu.org
2020-12-08 16:27 ` dpozar at ecs dot umass.edu
2020-12-08 17:36 ` kargl at gcc dot gnu.org
2020-12-08 18:19 ` tkoenig at gcc dot gnu.org
2020-12-08 19:13 ` dpozar at ecs dot umass.edu
2020-12-08 19:27 ` tkoenig at gcc dot gnu.org
2020-12-08 20:46 ` dpozar at ecs dot umass.edu
2020-12-08 22:06 ` kargl at gcc dot gnu.org
2020-12-09  0:28 ` dpozar at ecs dot umass.edu
2020-12-09  4:38 ` sgk at troutmask dot apl.washington.edu
2020-12-09 13:24 ` dpozar at ecs dot umass.edu
2020-12-09 15:37 ` sgk at troutmask dot apl.washington.edu
2020-12-09 16:04 ` dpozar at ecs dot umass.edu
2021-03-28 12:38 ` dominiq at lps dot ens.fr
2021-03-28 13:05 ` dpozar at ecs dot umass.edu
2021-03-28 13:16 ` dominiq at lps dot ens.fr

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).