Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2001-10

May be a bug in FPC 1.0.4

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

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

Reply by email

Unknown author

Oh, mama mia! Excuse me! This is my bug, not a FPC's one! :))) Don't think I wrote you a mail just after I found some problems: I tried to correct this bug few hours! Excuse me!

===8<==============Original message text=============== 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

===8<===========End of original message text===========

Best regards,
grizly

Reply by email