This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: optimization issue about -O2 and -Os
- From: "Dave Korn" <dk at artimi dot com>
- To: "'gcc_mailing_list'" <gcc at gcc dot gnu dot org>
- Date: Fri, 30 Apr 2004 10:46:14 +0100
- Subject: RE: optimization issue about -O2 and -Os
> -----Original Message-----
> From: gcc-owner On Behalf Of Jim Wilson
> Sent: 30 April 2004 05:06
> On Thu, 2004-04-29 at 19:34, Ebony Zhu wrote:
> > Have you ever been troubled in the same problem? Are you
> sure it's a gcc
> > bug, and not a mistake I probably made when building the cross tool?
> > (e.g. missed some important options when building gcc).
>
> If something compiled with -O2 works and something compiled with -Os
> does not work, then the logical conclusion is that the -Os option is
> buggy.
>
> However, it is possible that something went wrong with your build, if
> you are trying to do something complicated. Since you didn't say
> anything about how you built the toolchain, or what you built, I can't
> comment on this. I was just assuming that you had one toolchain, and
> the only thing that changed was the -O2/-Os option when using it.
>
> I deal with gcc bugs everyday, but I don't have any specific knowledge
> about -Os PPC gcc-3.3.2 bugs.
>
> You might try debugging the problem a bit to see what is
> wrong. Run the
> programs under gdb and see where they fail. Put a breakpoint
> in main to
> see if maybe they fail before main is reached. Etc.
Use -fverbose-asm in conjunction with --save-temps to get a list of the
optimisations in effect at the top of each assembler code file. Try it with
-Os and -O2, and note the differences between them. You may be able to
narrow it down to a specific -f flag by starting with -O2 and introducing
the changes between that and -Os one at a time.
cheers,
DaveK
--
Can't think of a witty .sigline today....