Re: [fpc-devel]PowerPC, TypInfo

2004-08-15 Thread Mattias Gaertner
On Sun, 15 Aug 2004 00:20:47 +0200  Florian Klaempfl [EMAIL PROTECTED]
wrote:

 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
aligned?


Mattias

___
fpc-devel maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel]PowerPC, TypInfo

2004-08-15 Thread Florian Klaempfl
Jonas Maebe wrote:
On 15 aug 2004, at 00:20, Florian Klaempfl wrote:
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.

So? What if the last field is a byte and is stored in the last byte of 
the e.g. 100 bytes that the class occupies? Keep in mind that getordprop 
does not necessarily read from a 4-byte aligned address. It simply reads 
4 bytes from the start address of the field, and then ands the result 
with $ff if the size of the field was 1 byte.
Ops :) It seems I worked too much with my sparc ;)
___
fpc-devel maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel]FPC Source Paths under darwin

2004-08-15 Thread Mattias Gaertner

Which system.pp is used for darwin/system.ppu?


Mattias

-- 

___
fpc-devel maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel]FPC Source Paths under darwin

2004-08-15 Thread Jonas Maebe
On 15 aug 2004, at 18:19, Mattias Gaertner wrote:
Which system.pp is used for darwin/system.ppu?
rtl/bsd/system.pp
Jonas
___
fpc-devel maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-devel