[Bug middle-end/35877] difference between result in optimized and normal executable

jb at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Apr 14 23:01:00 GMT 2008



------- Comment #4 from jb at gcc dot gnu dot org  2008-04-14 23:01 -------
(In reply to comment #3)
> Hi, first of all thanks for your comment
> I don't use i0 in the program - it's inside of the quotes
> so test is fine

Uh oh, yes of course. How embarrassing. Sorry for that.

> I made all changes you made
> and still in 4.3 (opt) I'm getting (+Inf, Nan)
> it looks like that 4.4 fixes that Inconsistence
> I just don't build 4,4 to check
> thanks again

Anyway, I'm reassigning this to middle-end, since regardless of optimization
level the gfortran frontend generates identical trees. Attached is a roughly
equivalent C testcase for the middle-end guys:

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

// Compile with -std=c99 -lm

int main(void)
{
    double complex nan_inf, normal_number, cmplx_test;
    double tth = 0.6666666666666667;
    normal_number = tth + I*0;
    nan_inf = 1.0/0.0 + I*(0.0/0.0);
    cmplx_test = nan_inf * normal_number;
    printf ("nan_inf (%f, %f)\n", creal(nan_inf), cimag(nan_inf));
    printf ("nan_inf * (tth,0): (%f, %f)\n", creal(cmplx_test),
cimag(cmplx_test));
    cmplx_test = nan_inf * tth;
    printf ("nan_inf * tth: (%f, %f)\n", creal(cmplx_test), cimag(cmplx_test));
}

Results with 

Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../trunk/configure --enable-languages=c,fortran
--prefix=/home/job/src/gfortran/inst : (reconfigured) ../trunk/configure
--prefix=/home/job/src/gfortran/inst --enable-languages=c,fortran --no-create
--no-recursion : (reconfigured) ../trunk/configure
--prefix=/home/job/src/gfortran/inst --enable-languages=c,fortran --no-create
--no-recursion : (reconfigured) ../trunk/configure
--prefix=/home/job/src/gfortran/inst --enable-languages=c,fortran --no-create
--no-recursion
Thread model: posix
gcc version 4.4.0 20080414 (experimental) (GCC) 

and

Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic
--host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)

$ ./gcc41-noopt 
nan_inf (nan, nan)
nan_inf * (tth,0): (nan, nan)
nan_inf * tth: (nan, nan)
$ ./gcc41-opt 
nan_inf (inf, nan)
nan_inf * (tth,0): (inf, nan)
nan_inf * tth: (inf, nan)
$ ./gcc44-noopt 
nan_inf (nan, nan)
nan_inf * (tth,0): (nan, nan)
nan_inf * tth: (nan, nan)
$ ./gcc44-opt 
nan_inf (inf, nan)
nan_inf * (tth,0): (inf, nan)
nan_inf * tth: (inf, nan)


-- 

jb at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|fortran                     |middle-end


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



More information about the Gcc-bugs mailing list