nc-gaertnma at netcologne.de
Sun Aug 15 11:46:03 CEST 2004
On Sun, 15 Aug 2004 00:20:47 +0200 Florian Klaempfl <F.Klaempfl at gmx.de>
> Jonas Maebe wrote:
> > On 14 aug 2004, at 21:07, Mattias Gaertner wrote:
> >>> The GetOrdProp is used to read boolean values. It reads a longint and
> >>> applies "and $ff" to get only the lowest byte. Under PowerPC the
> >boolean>> value is stored just like under i386 in the first byte. Reading
> >the>> longint under i386 works, but of course it does not under powerpc.
> >>> So, either the compiler is wrong or the GetOrdValue function is wrong.
> >>> Which one should I report?
> >> I just found out, that this is also the case for ShortInt, SmallInt,
> >Word> and Byte, but not for enums.
> > To me, the fact that it always reads a longint regardless of the size of
> > the property seems to be inherently wrong. What if the last field of a
> > class is a byte? Then you can read past the end of the class, possibly
> > into unallocated memory causing a crash, no?
> No. Classes are always allocated on the heap so the memory block is
> always at least a multiple of 4.
The longint is read from the start of the SmallInt, so if the class is
packed, its adress is not a multiple of 4. Or are all class variables 4 byte
More information about the fpc-devel