[fpc-pascal] records - really a bug?

chromdildo chromdildo at t-online.de
Wed May 25 12:21:25 CEST 2005


Thanks for the quick reply.
...I see, stupid me. :)

But when the position of "amtsbelegung : Tchange_bool;" is changed, no
AV occurs ..?
Reproducable?
Something about Memory Acces....  I think I got it.

Best regards
./chrom



Florian Klaempfl wrote:

>chromdildo wrote:
>
>Well, in your program :) Compile with range checking ot see it.
>
>  
>
>>Hello everybody.
>>
>>I discovered a very strange bug/issue and I don't know how to describe
>>it best as a bug-report.
>>(or am I doing something wrong?)
>>I try: a variable declared within a record, AccessViolates when set
>>later in code,
>>if declared at the "wong" place..?..
>>
>>(environment: linux/i686 - fpc 2.0.0)
>>look at this small snipplet: (attached full testing.pas source for
>>reproduction):
>>
>>//<-snip->
>>type Teumex_memory = record
>>     pin          : Tchange_string;
>>     // amtsbelegung : Tchange_bool;    // <-- leave it here, everything
>>is ok.
>>     msn          : array [0..9] of Tchange_string;
>>     port         : array [0..9] of Tchange_string;
>>     amtsbelegung : Tchange_bool;    // <-- put it there: Access
>>violation when amtsbelegung is set
>>end;
>>//<-snip->
>>
>>
>>Best regards
>>./chrom
>>
>>
>>------------------------------------------------------------------------
>>
>>program bugtest;
>>
>>{$mode objfpc}{$H+}
>>
>>uses classes, sysutils;
>>
>>
>>
>>type Tchange_string = record
>>     value: string;
>>     changed : boolean;
>>end;
>>
>>type Tchange_int= record
>>     value: integer;
>>     changed : boolean;
>>end;
>>
>>type Tchange_bool= record
>>     value: boolean;
>>     changed : boolean;
>>end;
>>
>>//The internal memory of the eumex (sample)
>>type Teumex_memory = record
>>     pin          : Tchange_string;
>>     
>>     // amtsbelegung : Tchange_bool;    // <-- leave it here, everything is ok.
>>
>>     msn          : array [0..9] of Tchange_string;
>>     port         : array [0..9] of Tchange_string;
>>
>>     amtsbelegung : Tchange_bool;	// <-- put it there: Access violation when setting
>>end;
>>
>>
>>
>>TEumex = class			
>>        private
>>                FMemory : Teumex_memory;
>>        public
>>               property  Memory  : Teumex_memory read FMemory write FMemory;
>>end;
>>
>>
>>var Eumex1      : TEumex;
>>    ic          : integer;
>>
>>
>>begin
>>  Eumex1 := TEumex.create;
>>
>>  writeln ('setting PIN:');
>>  Eumex1.Memory.pin.value := '1234';
>>  Eumex1.Memory.pin.changed := true;
>>
>>  writeln ('setting amtsbelgegung');
>>  Eumex1.Memory.amtsbelegung.value := true;   // <-- Access violation, if declared like above
>>  Eumex1.Memory.amtsbelegung.changed := true;
>>
>>  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;
>>
>>
>>end.
>>
>>
>>------------------------------------------------------------------------
>>
>>_______________________________________________
>>fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
>>http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>    
>>
>
>
>_______________________________________________
>fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
>http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>  
>





More information about the fpc-pascal mailing list