[fpc-pascal] crash in lazbuild only on powerpc 64bit

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Sep 24 12:12:38 CEST 2012


On Mon, 24 Sep 2012 11:43:32 +0200
Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:

> 
> Mattias Gaertner wrote on Sun, 23 Sep 2012:
> 
> > Calling the method directly does not crash.
> > Comparing the property and the address gives true:
> >
> > 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.

The designer casts events using the TMethod record (Data, Code).
How does this work under ppc64?

 
> That may also be related to main problem in your code, although the  
> fact that the descriptors match suggests that it isn't.

There are some cases in the FCL and Laz sources where events are
compared. But this is not one of them.

Assigning a method to a property and calling it is done at thousands of
places in the Lazarus sources and is also executed many times before
the crash. I don't see yet, why this place is special.

Mattias



More information about the fpc-pascal mailing list