[fpc-pascal] reference-counted function results not initialized to nil

David Emerson dle3ab at angelbase.com
Sat Jun 25 04:04:50 CEST 2016


Hi all,

After upgrading fpc 2.6.4 -> 3.0.0, I'm seeing a bug where (as noted in 
subject) reference-counted function results are not being initialized to 
nil.

Is this a known bug?

I am seeing it in ansistrings and also dynamic arrays. Here is an 
example program to see it with ansistrings:

function new_string : ansistring;
   begin
     new_string := new_string + 'x';
   end;

begin
  writeln (new_string); // outputs: x
  writeln (new_string); // outputs: xx
  writeln (new_string); // outputs: xxx
end.

Reproducing with dynamic arrays seems to be a bit trickier, I haven't 
made a test case yet, but I think I will be able to if required.

What to do?

Thanks,
David





More information about the fpc-pascal mailing list