This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Flags -g and -O give very different results
- From: Brian Gough <bjg at network-theory dot co dot uk>
- To: Michael P Friedlander <mpf at cs dot ubc dot ca>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 03 Jul 2006 11:40:15 +0100
- Subject: Re: Flags -g and -O give very different results
- References: <E66B4AA7-08CD-4147-B307-78FDBDF27DFB@cs.ubc.ca>
At Fri, 30 Jun 2006 19:35:03 -0700,
Michael P Friedlander wrote:
> The behavior of a numerical code I'm working on varies
> drastically depending on whether I've compiled it with
> the -g or -O flags.
>
> The code's behavior under -g is much more stable, and I'm
> wondering if the -O flag is exposing a bug that I need to
> fix. Are there some gcc flags that I should try that might
> guide me in finding the problem? (I've already tried the
> obvious -Wall which gives no warnings.)
A couple of other generally useful options for numerical
programs: -W, -Wconversion
Also test your code for memory errors with valgrind or
-fmudflap.
Most likely you'll have to look at the code itself and
see where the differences come from.
--
Brian Gough
Network Theory Ltd,
Publishing Free Software Manuals --- http://www.network-theory.co.uk/