public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Need some clarification about optimization flags, what "exactly" does -O1 do?
@ 2008-11-27 11:19 Andrzej Giniewicz
  2008-11-27 11:23 ` Brian Dessent
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Andrzej Giniewicz @ 2008-11-27 11:19 UTC (permalink / raw)
  To: gcc-help

Hi - it's my first time on that list, I hope I choose good one as gcc
have really quite number of different mailing lists :)

lately I hit very strange behaviour, i.e. the app I wanted to build
works when I build it with -O0 but crash at -O1, I wanted to eliminate
flags that work as I usually do, by doing -O0 and adding all flags
that are on -O1 and aren't on -O0, I got their list using standard
recommended by manual way:

g++ -c -Q -O0 --help=optimize > 0.flags
g++ -c -Q -O1 --help=optimize > 1.flags
diff 0.flags 1.flags | grep enabled

the problem is that I was able to add all flags returned by above
commands! Is there some secret things that -O1 do instead of only
lighting those -f*** flags listened by above commands? If above
returned me:

-fcprop-registers -fdefer-pop -fguess-branch-probability
-fif-conversion -fif-conversion2 -fipa-pure-const -fipa-reference
-fmerge-constants -fomit-frame-pointer -fsplit-wide-types -ftree-ccp
-ftree-ch -ftree-copy-prop -ftree-copyrename -ftree-dce
-ftree-dominator-opts -ftree-dse -ftree-fre -ftree-salias -ftree-sink
-ftree-sra -ftree-ter -funit-at-a-time

is there any difference / reason why in my case:

-O1

fails but:

-O0 -fcprop-registers -fdefer-pop -fguess-branch-probability
-fif-conversion -fif-conversion2 -fipa-pure-const -fipa-reference
-fmerge-constants -fomit-frame-pointer -fsplit-wide-types -ftree-ccp
-ftree-ch -ftree-copy-prop -ftree-copyrename -ftree-dce
-ftree-dominator-opts -ftree-dse -ftree-fre -ftree-salias -ftree-sink
-ftree-sra -ftree-ter -funit-at-a-time

works?... I build with athlon-xp architecture but same happens when I
do i686 (with tune=generic)... it's of course Linux, and I use GCC
4.3.2

cheers,
Andrzej.

btw, the problem I have is during run of OGRE3D engine so quite huge
app, I managed to track the problem up to this place:

            HardwareIndexBuffer::IndexType indexType =
mCurrentSection->get32BitIndices()? HardwareIndexBuffer::IT_32BIT :
HardwareIndexBuffer::IT_16BIT;

there IndexType is enum for only those two values that in any other
context are 0/1, and get32BitIndices is function returning bool, this
makes it kind of:

            int x = boolValue ? 0:1;

the problem is that any diagnostic, stwich/case/if for that value
equal HardwareIndexBuffer::IT_32BIT or HardwareIndexBuffer::IT_16BIT
fail, simple cout on it says it's 104... always, every run - every
build with anything more than -O0... it's working on -O0 thought and
-O0 with above flags... anyway for now question is rather about what
more than flags returned by those 3 mentioned lines of shell does -O1
do because I can just go on with disabling one feature and leaving
rest in place

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-12-01 12:44 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-27 11:19 Need some clarification about optimization flags, what "exactly" does -O1 do? Andrzej Giniewicz
2008-11-27 11:23 ` Brian Dessent
2008-11-27 11:34 ` Andrew Haley
2008-11-27 11:42   ` Andrzej Giniewicz
     [not found]   ` <f6d5b6a20811270333h3764c9a5jee3dbd95e6e76206@mail.gmail.com>
2008-11-27 14:33     ` Andrew Haley
2008-11-28 10:54       ` Andrzej Giniewicz
2008-11-28 11:29         ` Andrew Haley
2008-11-28 19:16           ` Andrzej Giniewicz
2008-11-29 11:50             ` Andrew Haley
2008-11-29 19:28               ` Andrzej Giniewicz
2008-11-29 20:43                 ` Andrzej Giniewicz
2008-11-30 12:12                   ` Andrew Haley
2008-11-28 23:37           ` Diego Novillo
2008-11-29 18:28             ` Andrew Haley
2008-12-01 12:44         ` John (Eljay) Love-Jensen
2008-11-28 19:03 ` Michael Meissner

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).