Thread View: gnu.gdb.bug
3 messages
3 total messages
Started by Gabriel Zachmann
Fri, 10 May 2002 13:59
numeric_limits<float>::max
Author: Gabriel Zachmann
Date: Fri, 10 May 2002 13:59
Date: Fri, 10 May 2002 13:59
47 lines
2910 bytes
2910 bytes
I have a funny problem with gdb (GNU gdb Red Hat Linux (5.1-1)):
In a C++ program I have the following two lines:
float v = -numeric_limits<float>::max();
fprintf(stderr,"v=%f\n", v );
When I run the program I always get the output
v=-340282346638528859811704183484516925440.000000
However, when I run the program in gdb I sometimes get this
375 float v = -numeric_limits<float>::max();
(gdb)
376 fprintf(stderr,"v=%f\n", v );
(gdb)
v=nan
^^^
Unfortunately, I seem to be unable to produce a small example program
exhibiting this behavior.
I compile the program with g++ 3.0.4 using these options:
-march=i686 -ansi -fno-default-inline -ffor-scope
-g3 -ggdb3 -Wall -W -Wpointer-arith
-Wcast-qual -Wcast-align -Wconversion -Woverloaded-virtual -Wsign-compare
-Wnon-virtual-dtor -Woverloaded-virtual -Wfloat-equal -Wmissing-prototypes
-Wunreachable-code -Wno-reorder -D_GNU_SOURCE
Does anybody have any idea what might cause this differing behavior?
Thanks a lot in advance,
Gabriel.
--
/---------------------------------------------------------------------\
| The mind -- what is it? |
| It is the sound of the breeze |
| Blowing through the pines in the picture. (Ikkyu) |
| |
| zach@cs.uni-bonn.de __@/' Gabriel.Zachmann@gmx.net |
| web.informatik.uni-bonn.de/~zach __@/' www.gabrielzachmann.org |
\---------------------------------------------------------------------/
Re: numeric_limits<float>::max
Author: Jim Blandy
Date: Fri, 10 May 2002 16:55
Date: Fri, 10 May 2002 16:55
55 lines
3058 bytes
3058 bytes
This sounds like a real bug. However, we really can't work on something without a way to reproduce the behavior ourselves. So if you do come up with a small test program, at the very least we'll included it in our test suite, to remind us that the bug is there. Gabriel Zachmann <zach@cs.uni-bonn.de> writes: > I have a funny problem with gdb (GNU gdb Red Hat Linux (5.1-1)): > > In a C++ program I have the following two lines: > > float v = -numeric_limits<float>::max(); > fprintf(stderr,"v=%f\n", v ); > > When I run the program I always get the output > > v=-340282346638528859811704183484516925440.000000 > > However, when I run the program in gdb I sometimes get this > > 375 float v = -numeric_limits<float>::max(); > (gdb) > 376 fprintf(stderr,"v=%f\n", v ); > (gdb) > v=nan > > ^^^ > > Unfortunately, I seem to be unable to produce a small example program > exhibiting this behavior. > > I compile the program with g++ 3.0.4 using these options: > > -march=i686 -ansi -fno-default-inline -ffor-scope > -g3 -ggdb3 -Wall -W -Wpointer-arith > -Wcast-qual -Wcast-align -Wconversion -Woverloaded-virtual -Wsign-compare > -Wnon-virtual-dtor -Woverloaded-virtual -Wfloat-equal -Wmissing-prototypes > -Wunreachable-code -Wno-reorder -D_GNU_SOURCE > > Does anybody have any idea what might cause this differing behavior? > > Thanks a lot in advance, > Gabriel. > > > -- > /---------------------------------------------------------------------\ > | The mind -- what is it? | > | It is the sound of the breeze | > | Blowing through the pines in the picture. (Ikkyu) | > | | > | zach@cs.uni-bonn.de __@/' Gabriel.Zachmann@gmx.net | > | web.informatik.uni-bonn.de/~zach __@/' www.gabrielzachmann.org | > \---------------------------------------------------------------------/
Re: numeric_limits<float>::max
Author: Gabriel Zachmann
Date: Fri, 10 May 2002 23:19
Date: Fri, 10 May 2002 23:19
24 lines
2329 bytes
2329 bytes
> In a C++ program I have the following two lines: > > float v = -numeric_limits<float>::max(); > fprintf(stderr,"v=%f\n", v ); Sorry I forgot to mention that this happened under RedHat 7.2 with the gdb version that comes with RedHat 7.2. The good news is that it seems to have gone away with gdb 5.2 - I compiled gdb5.2 myself, and so far I have not been able to reproduce the bug - gdb always prints $5 = -3.40282347e+38, just as expected. Thanks a lot for your quick responses! Gab. -- /---------------------------------------------------------------------\ | The mind -- what is it? | | It is the sound of the breeze | | Blowing through the pines in the picture. (Ikkyu) | | | | zach@cs.uni-bonn.de __@/' Gabriel.Zachmann@gmx.net | | web.informatik.uni-bonn.de/~zach __@/' www.gabrielzachmann.org | \---------------------------------------------------------------------/
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads