Re: [PATCH RFC] Fix break.exp optimization related failure

Andrew Cagney
2003-09-27T15:46:50Z

> I recently encountered the following FAIL in the FR-V work that I've
> been doing:
>
> FAIL: gdb.base/break.exp: run until breakpoint set at small function, optimized file
>
> The reason for this failure is that gcc has optimized out the call
> to marker4(). I've determined that this happens not only using -O2,
> but with -O1 as well. Surprisingly, it even happens when using the
> following set of switches:
>
> -O1 -fno-defer-pop -fno-thread-jumps -fno-loop-optimize
> -fno-crossjumping -fno-if-conversion -fno-if-conversion2
> -fno-guess-branch-probability -fno-cprop-registers
> -fno-omit-frame-pointer
>
> The various -fno-* options *should* be disabling the set of options
> enabled by -O1. Anyway, I've been told that this optimization is
> a special case of GCSE and apparently there's no way to disable it
> via a command line switch.

I've been told it gets eliminated because it's a "pure function" and the
caller realises that the return value isn't used. You want to see what
happens to store.c!

We [GDB] are going to have to get GCC to decide, from a developers [and
not compiler writers] point of view, exactly what is reasonable at -O1.

We're probably also going to have to split up our test files in to
separate .c's so that the compiler can't see smarts like this :-/

Andrew