[fpc-devel] mising ansi string ref increase

Martin lazarus at mfriebe.de
Thu Jul 22 04:10:10 CEST 2010

I have an odd case (bug ?)
But I am unable to reproduce on a simple example.

Debugger output, and assembler both suggests it's in the compilation.
fpc from trunk a few weeks ago. using -OpPENTIUMM   -O1

one procedure is declared as
     procedure SetFoldState(const AValue: String);

another one calls this as follows
     if FPendingFoldState <> '' then

FPendingFoldState is a variable (String) of the object (both methods 
belong to the same object too)

Now in SetFoldstate is a line:

and after this AValue becomes corrupt

The assembler of the calling code (from -al)
# [6541] if FPendingFoldState <> '' then
     movl    -4(%ebp),%eax
     movl    1352(%eax),%eax
     testl    %eax,%eax
     je    .Lj12594
# [6542] SetFoldState(FPendingFoldState);
     movl    -4(%ebp),%eax
     movl    1352(%eax),%edx
     movl    -4(%ebp),%eax

There is no ansistring inc ref (both methods are in the same file, and 
yes {$H+}

Trying to reproduce in a smaller example did not bring results....

Anyone any idea, if there s any code that could cause such an 
"optimization" ?


More information about the fpc-devel mailing list