public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: CSights <csights@fastmail.fm>
To: gcc-help@gcc.gnu.org
Subject: binary compiled with -O1 and w/ individual optimization flags are not the same
Date: Fri, 29 Feb 2008 17:28:00 -0000	[thread overview]
Message-ID: <200802291215.47293.csights@fastmail.fm> (raw)

Hi,
	I'm trying to debug some mismatching results from a program compiled with 
O1,2,3) and without (-O0 or nothing) optimization flags.
	My thought was to individually turn on optimization flags and see which one 
changes the program's output.
	Unfortunately for this plan, the binaries produced using -O1 and those flags 
said to be turned on by g++ in the manual (-fdefer-pop -fdelayed-branch
-fguess-branch-probability -fcprop-registers -fif-conversion -fif-conversion2 
-ftree-ccp -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-ter -ftree-lrs 
-ftree-sra -ftree-copyrename -ftree-fre -ftree-ch -funit-at-a-time -fmerge-constants) 
do not match.  I also tried without -fdelayed-branch b/c it is not supported 
on my architectures (i386: athlon xp, core duo) and with -fomit-frame-pointer 
in case that was the difference.
	I've tried this with g++ versions
g++ (GCC) 4.2.3 (Debian 4.2.3-1) 
and
i686-apple-darwin8-g++-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5363)
	Is there a way to have g++ tell me which flags it is actually using when 
compiling a program.  E.g. expand -O1 to the individual optimization flags at 
run time?
	Anyone have any other suggestions?

Thanks much,
	C.

             reply	other threads:[~2008-02-29 17:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-29 17:28 CSights [this message]
2008-02-29 17:28 ` Andrew Haley
2008-02-29 17:40 ` Eljay Love-Jensen
2008-02-29 20:15 ` Brian Dessent
2008-02-29 22:38   ` CSights
     [not found]     ` <47C88B66.A501ABD6@dessent.net>
2008-03-01 15:59       ` CSights
2008-03-01 17:26         ` Tim Prince
2008-03-01 18:22         ` Brian Dessent
2008-03-05 18:13           ` CSights

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=200802291215.47293.csights@fastmail.fm \
    --to=csights@fastmail.fm \
    --cc=gcc-help@gcc.gnu.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: 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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).