[fpc-devel] Compiling for libgdb, and using make -j on larger SPARC systems
Sven Barth
pascaldragon at googlemail.com
Fri Aug 9 21:38:50 CEST 2013
On 09.08.2013 21:20, Sven Barth wrote:
>> > Could you please print
>> > somehow (either debugging or Writeln) the value of left.resultdef.typ
>> > (yes, without "e" at the end!) when len <= 0? Then we could at least
>> > check which def produces problematic results here (is suspect records,
>> > but just to be sure).
>>
>> That of course was one of the things I was asking :-) With code as below
>> (reformatted to avoid problems with wrap)
>>
>> else
>> begin
>> { TODO: HACK: unaligned test, maybe remove all unaligned locations
>> (array of char) from the compiler}
>> { Use unaligned copy when the offset is not aligned }
>> len:=left.resultdef.size;
>>
>> if len = 0 then begin
>> WriteLn('=====> len: ', len);
>> WriteLn('=====> typ: ', left.resultdef.typ)
>> 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
>> ..
>>
>> I get
>>
>> =====> len: 0
>> =====> typ: recorddef
>>
>> But it does appear to build properly on x86, without any zero-length
>> types.
>
> 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.
You might additionally add the following code to the end of the these
methods of "tabstractsymtable" in unit "symtable":
- setdatasize
- addfield
- addalignmentpadding
and also to "trecordsymtable.insertunionst" (also unit "symtable"):
=== code begin ===
if _datasize=0 then
begin
write('======> _datasize = 0 @', {$I %LINE%}, ': ');
if assigned(defowner) and (defowner.typ=recorddef) then
writeln(trecorddef(defowner).objname^)
else
writeln('<unknown>');
end;
=== code end ===
Regards,
Sven
More information about the fpc-devel
mailing list