[fpc-devel] probably incorrect debug-line-info generated by fpc 2.6.2 and trunk

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Nov 11 00:52:54 CET 2013


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


More information about the fpc-devel mailing list