Mail Archives: djgpp-workers/2000/02/29/15:19:40
On Tue, 29 Feb 2000, salvador wrote:
> Hans-Bernhard Broeker wrote:
> > This jumping back and forth, in and of itself, does not mean anything is
> > broken. During the optimization steps, the compiler may reorder statements
> > in a way that makes the debugger step back and forth in the source code.
>
> I agree, but that is not the case! the code isn't ejecuted during the
> first "pass", but in the second.
How would you know it's not executed? Have you checked the assembly
listing? Or followed changes to register contents? When a C instruction is
broken into several parts by the optimizer's instruction reordering phase,
intermediate results will be in registers, rather than in the actual
variables. I.e. gdb may not see them, at all.
> And also: is not just another order, you get the impression the code
> is ejecuted twice.
What's the difference you base this distinction on? If you step through
a two-line function, and gdb shows line numbers
1
2
1
2
in that order, what makes this look like the function being executed
twice, instead of parts of lines one and two having been mixed with each
other, on assembly level?
If you still don't believe this, show me a small example case, together
with its assembly listing ('gcc -gstabs3+ -S' output, or a '-g -Wa,-alhs'
listing), so we can see what it's actually doing.
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -