[fpc-devel]May be a bug in FPC 1.0.4

grizly_ru at mail.ru grizly_ru at mail.ru
Sat Oct 6 15:21:49 CEST 2001


Hello, developers,

I think, I have been found a bug in FPC 1.0.4. In OBJFPC mode the
boolean type fields of some record work strange. F.e.:

type
 sc = record
   ......
   d: boolean;
   ......
      end;
 psc = ^sc;

var
 l: TList;
 a: psc;

.....
//Creating
for i:=0 to x do begin new(a); a^.d:=false; l.Add(a); end;
.....
//Initializing
for i:=0 to l.Count-1 do if Anything then a(l.Items[i])^.d:=not
a(l.Items[i])^.d;
.....
//Using
for i:=0 to l.Count-1 do if a(l.Items[i])^.d then DoSomething; //here
//the values of d field are incorrect, but values of other fields are
//correct

I made in my program operations like these. l object and psc type are
declared in a global definitions unit (used in every other unit in
program). a variable is declared in current unit.
I initialize l in one unit, and use in in another one. But
from the other unit (and also outside the for..do where I initialize
l, but in the same unit) the values of boolean field are incorrect.
Values of other type fields are correct. At the end I used char type
instead of boolean ('Y'=true 'N'=false) and with chars all worked
correctly.

Best regards,
 grizly                          mailto:grizly_ru at mail.ru






More information about the fpc-devel mailing list