From: Michael Chastain <mec.gnu@mindspring.com>
To: ibr@ata.cs.hun.edu.tr
Cc: gdb@sources.redhat.com
Subject: Re: bug disappears if compiled with -O0
Date: Mon, 26 Jul 2004 03:55:00 -0000 [thread overview]
Message-ID: <41047629.nailSP1ZPLRF@mindspring.com> (raw)
In-Reply-To: <20040725223832.GB8947@ata.cs.hun.edu.tr>
Baurjan Ismagulov <ibr@ata.cs.hun.edu.tr> wrote:
> I'm trying to track down a problem in a dynamic library. However, the
> bug doesn't show up if the code is compiled with -O0 (it is normally
> compiled with -O2). Any pointers or tips on how to proceed (except
> printf)?
gdb can debug code generated with gcc -g -O2. However, when debugging
optimized code, things like "next" appear to skip around, and variables
sometimes don't contain the values that you think that they should.
You could try gcc 3.4.1. Just use "--prefix" to build it and you can
locate it in its own directory, so you can safely experiment with
different compilers.
You didn't mention what language your library is written in.
If the bug truly is a code generation bug, then you will need to read
assembly language to isolate the bug. Also, adding "printf"
(or other function calls) in the middle of a function can make the
bug disappear, because the results of optimization change when you
invade with a function call.
Michael C
next prev parent reply other threads:[~2004-07-26 3:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-26 3:10 Baurjan Ismagulov
2004-07-26 3:55 ` Michael Chastain [this message]
2004-07-26 21:13 ` Baurjan Ismagulov
2004-07-26 21:19 ` Kip Macy
2004-07-27 0:52 ` Michael Chastain
2004-07-26 5:47 ` Eli Zaretskii
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=41047629.nailSP1ZPLRF@mindspring.com \
--to=mec.gnu@mindspring.com \
--cc=gdb@sources.redhat.com \
--cc=ibr@ata.cs.hun.edu.tr \
/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: link
Be 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