public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "dpovey at gmail dot com" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug c++/13943] New: gdb does not correctly handle underflow in the "print" command Date: Wed, 04 Apr 2012 11:00:00 -0000 [thread overview] Message-ID: <bug-13943-4717@http.sourceware.org/bugzilla/> (raw) http://sourceware.org/bugzilla/show_bug.cgi?id=13943 Bug #: 13943 Summary: gdb does not correctly handle underflow in the "print" command Product: gdb Version: 7.3 Status: NEW Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned@sourceware.org ReportedBy: dpovey@gmail.com Classification: Unclassified If a and b are doubles, and a / b underflows to zero, gdb "print" will wrap around the exponent to make a very large value. Example below. a09:s3: cat foo.cc #include <cstdlib> main() { double a = 9.8813129168249309e-323, b = 1000; abort(); } a09:s3: g++ -g foo.cc -o foo a09:s3: gdb foo GNU gdb (GDB) 7.3-debian Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /export/proceedings/dpovey_temp/kaldi-trunk/egs/rm/s3/foo...done. (gdb) r Starting program: /export/proceedings/dpovey_temp/kaldi-trunk/egs/rm/s3/foo Program received signal SIGABRT, Aborted. 0x00007ffff72ef405 in *__GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 64 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory. in ../nptl/sysdeps/unix/sysv/linux/raise.c (gdb) up #1 0x00007ffff72f2680 in *__GI_abort () at abort.c:92 92 abort.c: No such file or directory. in abort.c (gdb) list 87 in abort.c (gdb) up #2 0x0000000000400568 in main () at foo.cc:5 5 abort(); (gdb) list 1 #include <cstdlib> 2 3 main() { 4 double a = 9.8813129168249309e-323, b = 1000; 5 abort(); 6 } 7 (gdb) p a / b $2 = -3.1933444952555512e+291 <-------------- HERE IS THE BUG. Should be small (gdb) quit -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
reply other threads:[~2012-04-04 11:00 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-13943-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).