joachim@iraul1.ira.uka.de (Joachim Lindenberg) (08/02/88)
The MPW 2.0.2 Pascal compiler (Pascal V2.0.2 (11/10/87)) produces
wrong code to access the last member of a packed record, if this
last member is a Byte (not a SignedByte) value and starts (or is
supposed to start) on an even address. The produced code is correct
if either the byte value is the only record member, or if after that
member an additional field (pad) is added.
The following source/object illustrates this bug:
program Bug;
uses memtypes;
var test : packed record
fill : integer;
value : Byte;
{ pad : byte }
end;
begin
test.value := 1;
end.
..which produces the following result (taken from dumpobj):
000000: 4EBA 0000 'N...' JSR *+$0002 ; 00000002
000004: 4E56 0000 'NV..' LINK A6,#$0000
000008: 2C5F ',_' MOVEA.L (A7)+,A6
00000A: 4EBA 0000 'N...' JSR *+$0002 ; 0000000C
00000E: 3B7C 0001 FFFE ';|....' MOVE.W #$0001,$FFFE(A5)
^^ wrong, should be .B !!!
000014: 4EBA 0000 'N...' JSR *+$0002 ; 00000016
000018: 4EBA 0000 'N...' JSR *+$0002 ; 0000001A
00001C: 4E75 'Nu' RTS
00001E: 4E5E 'N^' UNLK A6
000020: 4E75 'Nu' RTS
Tom Schulz, Joachim Lindenberg,
Dept. of Computer Science, University of Karlsruhe