[fpc-pascal] records - really a bug?

Jonas Maebe jonas at zeus.ugent.be
Wed May 25 12:11:46 CEST 2005


On 25 mei 2005, at 12:06, chromdildo wrote:

>      msn          : array [0..9] of Tchange_string;
>      port         : array [0..9] of Tchange_string;

This array goes from 0 till 9

>   for ic:= 1 to 10 do begin
>       Eumex1.Memory.msn[ic].value := '';
>       Eumex1.Memory.msn[ic].changed := false;
>       Eumex1.Memory.port[ic].value := '0';
>       Eumex1.Memory.port[ic].changed := false;
>   end;

And here you go from 1 to 10. The reason it doesn't crash in one case 
and that it does crash in another case, is due to alignment differences 
(in the "crash case", your record is bigger, so there is more chance 
you will write beyond the boundary of allocated memory).


Jonas





More information about the fpc-pascal mailing list