fpc/tests/webtbs/tw13563.pp
Jonas Maebe 10158da60e * give an error when trying to use the offset of a non-byte-aligned field
of a bitpacked record in assembler code
  * convert the offsets of byte-aligned fields of bitpacked records from bits
    to bytes (mantis #13563)

git-svn-id: trunk@13027 -
2009-04-23 17:27:44 +00:00

49 lines
681 B
ObjectPascal

{ %cpu=i386 }
{ %opt=-Cg- }
program bug;
type
br=bitpacked record //Note! "bitpacked"
l:longword;
m:longword;
h:longword;
end;
var
l,
m,
moffs,
h: longword;
test:br;
{$asmmode att}
begin
with test do
begin
l:=4;
m:=8;
h:=$f
end;
asm
movl br.m,%eax //eax should be 4,but it is 32. Eight times. error!
movl %eax, moffs
movl test.m,%eax //eax should be 8,but it is, a strange number. error!
movl %eax, m
movl test.l,%eax
movl %eax, l
movl test.h,%eax
movl %eax, h
end;
if (moffs<>4) then
halt(1);
if (m<>8) then
halt(2);
if (l<>4) then
halt(3);
if (h<>$f) then
halt(4);
end.