[fpc-pascal] crash in lazbuild only on powerpc 64bit
Jonas Maebe
jonas.maebe at elis.ugent.be
Mon Sep 24 12:38:18 CEST 2012
Mattias Gaertner wrote on Mon, 24 Sep 2012:
> On Mon, 24 Sep 2012 11:43:32 +0200
> Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
>
>> > writeln('This gives true=',OnGetIncludePath =
>> > @CodeToolBoss.GetIncludePathForDirectory);
>>
>> The result of such an expression is unpredictable on Linux/ppc64 and
>> on AIX. The reason is that on those platforms, procedure variables are
>> actually pointers to a descriptor (their ABI requires this). This
>> descriptor is 3 pointer large and contains the address of the routine
>> to be called, the value of the TOC pointer (r2) and the value of a
>> nested frame pointer (r11; unused by FPC). It's possible to have an
>> arbitrarily large number of different descriptors for the same routine
>> in a program, although the linker will try to merge them as much as
>> possible.
>
> Interesting.
> That explains why the compiler didn't let me cast it to a pointer.
I doubt it. As mentioned, procedure variables are pointers to
descriptions, so they're still pointers. It's just that they're not
guaranteed to be unique per procedure. At the parser level, procvars
are not handled differently than on other platforms iirc.
> The designer casts events using the TMethod record (Data, Code).
> How does this work under ppc64?
Exactly the same as on other platforms. The "code" field simply
contains a pointer to the descriptor instead of to the code of the
routine.
Jonas
More information about the fpc-pascal
mailing list