One test in data.cc crashes Octave 3.1.51
Sergei Steshenko
sergstesh at yahoo.com
Sat Aug 30 16:05:56 CDT 2008
--- On Sat, 8/30/08, Thomas Treichl <Thomas.Treichl at gmx.net> wrote:
> From: Thomas Treichl <Thomas.Treichl at gmx.net>
> Subject: Re: One test in data.cc crashes Octave 3.1.51
> To: "John W. Eaton" <jwe at bevo.che.wisc.edu>
> Cc: "bug at octave.org mailing list" <bug at octave.org>
> Date: Saturday, August 30, 2008, 12:11 PM
> 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
> _______________________________________________
> Bug-octave mailing list
> Bug-octave at octave.org
> https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave
Does everyone still think that compile warnings are just warning and not
errors, especially, a warning like this
MSparse.cc:614: warning: division by zero in ‘val / 0.’
in octave-3.0.2 make.log ?
I suggest to devote time to reading this thread:
http://gcc.gnu.org/ml/gcc/2007-01/msg00881.html
- was very revealing to me. I myself filed a bug against gcc and was
explicitly told that code behavior (mathematical results) depend on
optimizations in case of potential integer overflows, and I found this
running 'make check' of 'libsndfile'.
So I again suggest to treat every warning as error as the first step on
the way to make 'octave' (or any other program for that matter) as much as
possible independent from compiler 'mercy'.
Thanks,
Sergei.
More information about the Bug-octave
mailing list