fpc 3.2: "Declaration of type TTypeList changed"

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

fpc 3.2: "Declaration of type TTypeList changed"

Luca Olivetti-2
Hello,

as per the subject, I've been bitten by this change:

http://wiki.freepascal.org/User_Changes_Trunk#Declaration_of_type_TTypeList_changed


This code (FTasks is a specialization of TFPGList)

   for i:=0 to FTasks.Count-1 do
   begin
     FTasks.List^[i].rackData:=FindRack(FTasks[i].rack);
     FTasks.List^[i].cellData:=
         FindCell(FTasks[i].rackData,FTasks[i].cell);
   end;


worked before.

Now it compiles with no warnings but it segfaults.
(This is just an example, there are other instances where I use List^[]
and they also segfault).


I changed the above code to be

     LocTask:=FTasks[i];
     LocTask.RackData:=...;
     LocTask.CellData:=....;
     FTasks[i]:=LocTask;


but I don't understand why the former implementation bombs. The change
in the definition of TTypeList shouldn't have that effect, besides, as I
said, I get no warning compiling the code (apart from the ton of
messages about the assignment not inlined).

Bye
--
Luca
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpc 3.2: "Declaration of type TTypeList changed"

Free Pascal - General mailing list
Am 25.04.2019 um 22:23 schrieb Luca Olivetti:

> Hello,
>
> as per the subject, I've been bitten by this change:
>
> http://wiki.freepascal.org/User_Changes_Trunk#Declaration_of_type_TTypeList_changed 
>
>
>
> This code (FTasks is a specialization of TFPGList)
>
>   for i:=0 to FTasks.Count-1 do
>   begin
>     FTasks.List^[i].rackData:=FindRack(FTasks[i].rack);
>     FTasks.List^[i].cellData:=
>         FindCell(FTasks[i].rackData,FTasks[i].cell);
>   end;
>
>
> worked before.
>
> Now it compiles with no warnings but it segfaults.
> (This is just an example, there are other instances where I use
> List^[] and they also segfault).
>
>
> I changed the above code to be
>
>     LocTask:=FTasks[i];
>     LocTask.RackData:=...;
>     LocTask.CellData:=....;
>     FTasks[i]:=LocTask;
>
>
> but I don't understand why the former implementation bombs. The change
> in the definition of TTypeList shouldn't have that effect, besides, as
> I said, I get no warning compiling the code (apart from the ton of
> messages about the assignment not inlined).
Seems I forgot to correctly adjust the GetList methods. I fixed that in
trunk now and will arange for a merge to 3.2.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpc 3.2: "Declaration of type TTypeList changed"

Luca Olivetti-2
El 26/4/19 a les 10:14, Sven Barth via fpc-pascal ha escrit:

> Seems I forgot to correctly adjust the GetList methods. I fixed that in
> trunk now and will arange for a merge to 3.2.

Thanks, I see it was a simple fix.

Bye
--
Luca
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal