One test in data.cc crashes Octave 3.1.51

Thomas Treichl Thomas.Treichl at gmx.net
Sat Aug 30 14:11:06 CDT 2008


John W. Eaton schrieb:
> | So both system results are different from the results that you can see on your 
> | system. I think that I could need another small portion of help about what I 
> | could/should do now.
> 
> What version of GCC?

$ g++-4.0 --version
i686-apple-darwin8-g++-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5370)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ for v in 4.0 ; do echo $v ; rm -f a.out ; g++-$v foo.cc ; ./a.out ; rm -f 
a.out ; g++-$v -O foo.cc ; ./a.out ; done
4.0
foo.cc: In function 'int main()':
foo.cc:8: warning: division by zero in '1.0e+0 / 0.'
(inf,nan)
foo.cc: In function 'int main()':
foo.cc:8: warning: division by zero in '1.0e+0 / 0.'
(inf,nan)

> Here is what I see on my system:
> 
>   segfault:1> for v in 3.3 4.0 4.1 4.2 4.3 ; do echo $v ; rm -f a.out ; g++-$v foo.cc ; ./a.out ; rm -f a.out ; g++-$v -O foo.cc ; ./a.out ; done
>   3.3
>   foo.cc: In function `int main()':
>   foo.cc:8: warning: division by zero in `1.0e+0 / 0.'
>   foo.cc:11: error: call of overloaded `log(int)' is ambiguous
>   <internal>:11: error: candidates are: double std::log(double)
>   /usr/include/c++/3.3/cmath:411: error:                 float std::log(float)
>   /usr/include/c++/3.3/cmath:419: error:                 long double 
>      std::log(long double)
>   -bash: ./a.out: No such file or directory
>   foo.cc: In function `int main()':
>   foo.cc:8: warning: division by zero in `1.0e+0 / 0.'
>   foo.cc:11: error: call of overloaded `log(int)' is ambiguous
>   <internal>:11: error: candidates are: double std::log(double)
>   /usr/include/c++/3.3/cmath:411: error:                 float std::log(float)
>   /usr/include/c++/3.3/cmath:419: error:                 long double 
>      std::log(long double)
>   -bash: ./a.out: No such file or directory
>   4.0
>   foo.cc: In function 'int main()':
>   foo.cc:8: warning: division by zero in '1.0e+0 / 0.'
>   (inf,nan)
>   foo.cc: In function 'int main()':
>   foo.cc:8: warning: division by zero in '1.0e+0 / 0.'
>   (inf,nan)
>   4.1
>   foo.cc: In function 'int main()':
>   foo.cc:8: warning: division by zero in '1.0e+0 / 0.'
>   (inf,nan)
>   foo.cc: In function 'int main()':
>   foo.cc:8: warning: division by zero in '1.0e+0 / 0.'
>   (inf,2.26618)
>   4.2
>   foo.cc: In function 'int main()':
>   foo.cc:8: warning: division by zero in '1.0e+0 / 0.'
>   (inf,nan)
>   foo.cc: In function 'int main()':
>   foo.cc:8: warning: division by zero in '1.0e+0 / 0.'
>   (inf,2.26618)
>   4.3
>   (inf,nan)
>   (inf,2.26618)
> 
> 
> so it looks like the behavior has changed over time but is still not
> quite right as there is a difference depending on whether optimization
> is enabled.
> 
> My view is (nearly all) compiler or tool bugs are outside the scope of
> the Octave project, especially when fixes exist in the form of newer
> versions of the tools.  So in this case, I think the thing to do is
> upgrade your compiler.

Hhhmmm... I thought to get that answer. This wouldn't be a problem for me but if 
I still want to share Octave.app with others then they maybe would need to use 
the same compiler configuration?! I must think about it if I should change to a 
newer version...
On the other hand I also understand your reasons - compiler problems should 
really be out of the scope of the Octave project.

> And it would be nice if someone could also
> report the apparent bug in GCC.  I don't think it should give
> different results depending on the optimization flag.

Can somebody else please do this with the reference examples of more than just 
one compiler available (like John did above). Maybe a GNU/Linux machine would be 
better here as a reference then my Mac...

   Thomas


More information about the Bug-octave mailing list