Chris Lattner wrote:>Could you try compiling and running this program: > >--- >#include <limits> >#include <iostream> >int main() { > std::cerr << std::numeric_limits<float>::infinity() << "\n"; >} >--- > >Sure thing. It prints "0". Calling that inifinity is somewhat of a stretch, isn't it ? What on earth is going on here? Log: ---------- [finna at coplin11 debug]$ cat - > tst.cpp #include <limits> #include <iostream> int main() { std::cerr << std::numeric_limits<float>::infinity() << "\n"; } [finna at coplin11 debug]$ g++ tst.cpp [finna at coplin11 debug]$ ./a.out 0 ---------- Thanks a lot for your time and dedication on this subject. Best regards /Finn
On Wed, 5 May 2004, Finn S Andersen wrote:> Chris Lattner wrote: > > >Could you try compiling and running this program: > > > >--- > >#include <limits> > >#include <iostream> > >int main() { > > std::cerr << std::numeric_limits<float>::infinity() << "\n"; > >} > >--- > > > > > Sure thing. It prints "0". Calling that inifinity is somewhat > of a stretch, isn't it ?Well I think that explains why the linscan allocator doesn't work for you! :) It looks like numeric_limits::infinity has had a line of problems: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5527 http://lists.suse.com/archive/suse-programming-e/2003-Mar/0004.html> What on earth is going on here?I think that we should switch to C constants in this case. Can you try #include <math.h> and use HUGE_VAL instead? -Chris -- http://llvm.cs.uiuc.edu/ http://www.nondot.org/~sabre/Projects/
Chris Lattner wrote:>I think that we should switch to C constants in this case. Can you try >#include <math.h> and use HUGE_VAL instead? >It works: [finna at coplin11 ~/test]$ cat tst.cpp #include <limits> #include <iostream> #include <math.h> int main() { std::cerr << std::numeric_limits<float>::infinity() << "\n"; std::cerr << HUGE_VAL << "\n"; } [finna at coplin11 ~/test]$ g++ tst.cpp [finna at coplin11 ~/test]$ ./a.out 0 inf [finna at coplin11 ~/test]$ But making the consequential changes in LLVM seems trickier. Do you plan to correct it in CVS, or is there a path I can follow to fix it myself on my own installation ? Best regard /Finn