On Tue, Oct 24, 2006 at 05:51:09PM +0200, Claus Fischer wrote:
> Dan, thanks for replying so quickly.
> 
> The bug also happens in 'real' code.
> 
> This is only a very reduced showcase code for the bug,
> the bug also occurs in some (pretty big) code of mine
> where
>     if (0)
> is actually
>     if (!some_function(....))
> i.e. if the function failed, jump to the failure label.
> 
> 
> I believe the   -O0 -g   does not let gcc optimize the
> if (0) away; however, if it does, you'd have to place
> some dummy function in the if.

I can only examine testcases that are submitted, not vaguely described
real code.  Your belief in the last paragraph is obviously incorrect;
please take a moment to compile your posted testcase and see what you
get.

I can reproduce the problem with a more complex condition too.  In that
case, it's at best a debugging information problem.  The compiler has
eliminated the goto by transforming the if statement into a conditional
jump to the goto target.  When there is no code on a line, GDB uses the
next line with code.

Try "info line 6" for the line with the goto, to see what has happened.

-- 
Daniel Jacobowitz
CodeSourcery


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to