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

Sven Barth pascaldragon at googlemail.com
Fri Aug 9 21:20:10 CEST 2013


On 09.08.2013 21:03, Mark Morgan Lloyd wrote:
> Sven Barth wrote:
>
>>> if len <= 0 then
>>>    len := sizeof(aint);
>
>> So you changed the "len = 0" to "len <= 0"? Then this is very strange,
>> because that almost surely shouldn't happen.
>
> No, I /added/ those two lines to make sure that len was never zero. I'm
> not saying that it's a valid hack, but after seeing that len == 0 only
> in that one place (i.e. never when compiling the remainder of the
> compiler etc.) I thought it a worthwhile experiment.

Ah, 2.7.1 already contains (since April 2012) the check for "len = 0", 
but this was never merged to 2.6.x, because it was part of the JVM port.

>  > 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.

Regards,
Sven



More information about the fpc-devel mailing list