[fpc-devel] Compiling for libgdb, and using make -j on larger SPARC systems

Sven Barth pascaldragon at googlemail.com
Fri Aug 9 23:38:19 CEST 2013


On 09.08.2013 23:19, Mark Morgan Lloyd wrote:
> Sven Barth wrote:
>
>> Ok, so it is indeed a record that calculates the wrong size. Could you
>> please add the following code after the assignment of "len" and tell
>> me the output, so that we'll know which record exactly is the one that
>> fails?
>>
>> === code begin ===
>>
>> if len=0 then
>>   begin
>>     if left.resultdef.typ=recorddef then
>>       writeln('=======> objname: ',trecorddef(left.resultdef).objname^);
>>     len:=sizeof(pint);
>>   end;
>>
>> === code end ===
>>
>> I'll meanwhile investigate how a record calculates its size.
>
> Code reads (indent adjusted):
>
> len:=left.resultdef.size;
>
> if len = 0 then begin
>    WriteLn('=====> len: ', len);
>    WriteLn('=====> typ: ', left.resultdef.typ)
> end;
> if len=0 then
>    begin
>      if left.resultdef.typ=recorddef then
>        writeln('=======> objname: ',trecorddef(left.resultdef).objname^);
>      len:=sizeof(pint);
>    end;
> // if len <= 0 then
> //   len := sizeof(aint);
> { data smaller than an aint has less alignment requirements }
> alignmentrequirement:=min(len,sizeof(aint));
> if (right.location.reference.offset mod alignmentrequirement<>0) or
> ..
>
> Output is:
>
> ..
> Using assembler: /usr/bin/as
> =====> len: 0
> =====> typ: recorddef
> =======> objname: TVECTORREGS
> =====> len: 0
> =====> typ: recorddef
> =======> objname: TVECTORREGS
> =====> len: 0
> =====> typ: recorddef
> =======> objname: TVECTORREGS
> =====> len: 0
> =====> typ: recorddef
> =======> objname: TVECTORREGS
> /usr/local/src/fpc/fpcbuild-2.6.2/fpcsrc/libgdb/linux/sparc/libgdb.a(ada-lang.o):
> In function `scaling_factor':
> ..
>
> I'm just about to add your next tests and redo. Recompilation is slow,
> and I don't think that firing up a bigger machine and using make -j
> helps that much.
>

Ok, we now know that TVectorRegs is the culprit so we could try a 
simpler testcase than the whole IDE. Could you please try whether the 
following example triggers the exception as well? You can also speed up 
the compilation by just doing a "make cycle" in the compiler directory 
if this example works as intended.

=== code begin ===

program test;

const
   MaxRegs = 128;

type
   TVectorRegs = record
     reg : array [0..MaxRegs-1] of string;
   end;

   TVectorView = object
     OldRegs,NewRegs: TVectorRegs;
   end;

procedure DoAssignment(var aView: TVectorView);
begin
   aView.NewRegs := aView.OldRegs;
end;

var
   v: TVectorView;
begin
   DoAssignment(v);
end.

=== code end ===

Regards,
Sven



More information about the fpc-devel mailing list