Re: Single stepping a simple C-program, but...

Peter Toft
2008-05-20T07:19:51Z

On Mon, 19 May 2008 16:28:47 -0400, Daniel Jacobowitz <drow@false.org>
wrote:
> On Mon, May 19, 2008 at 10:18:36PM +0200, Peter Toft wrote:
>> Why does the second "step" i.e. "s" take me BACK to line 7 after I have
>> been in line 8????
>
> Probably because you compiled with optimization on. The compiler
> scheduled part of the call before the if was finished.
>
> --
> Daniel Jacobowitz
> CodeSourcery

Hi Daniel

Do you mean that since I have (assume A and B are two expressions - where A
is true)

if ( A || B)
do XYZ

then I go "A" -> "XYZ" -> and now "B" -> done

rather than the more obvious alternative that I go "A" -> "XYZ" -> done
since "A" was true then "B" is never evaluated.

This seems to be a sloppy compiled code or what?
Are there good reasons for this generated code?

Best

--
Peter Toft, Ph.D. [pto@linuxbog.dk] http://petertoft.dk
FÃ¸lg min Linux-blog pÃ¥ http://www.version2.dk/blogs/petertoft