[Bug fortran/98201] CSQRT function gives bad resuts at runtime
dpozar at ecs dot umass.edu
gcc-bugzilla@gcc.gnu.org
Tue Dec 8 15:54:29 GMT 2020
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.
More information about the Gcc-bugs
mailing list