On 10 Nov 2013, at 23:05, Martin wrote: > On 10/11/2013 21:55, Jonas Maebe wrote: >> On 10 Nov 2013, at 22:42, Martin wrote: >> >>> Why is the >>> movl %eax,-12(%ebp) >>> generated at the start of i:=i+1 >>> >>> Why does a statement save an outdated value to memory? >> Because the load back from memory that came right after it got removed by a >> peephole optimisation. Peephole optimisations are by definition local and >> have no clue about what happens next, and hence the store remains. >> > Ok, i understand, but that would mean hat the save originally was intended > for the "i := 1" statement.
The transformation that gets applied is movl const1,(mem1) movl (mem1),reg1 to: movl const1,reg1 movl reg1,(mem1) } The second instruction originally belonged to the second statement and hence has its line number info. > I only wonder, if despite the fact that O1 does not guarantee, if in this > case it would be worth to consider it a bug (and intend to fix it)? If someone wants to change it, they're free to do so. My days of working on the peephole optimisers are over. Jonas_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel