tw13563.pp 681 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. { %cpu=i386 }
  2. { %opt=-Cg- }
  3. program bug;
  4. type
  5. br=bitpacked record //Note! "bitpacked"
  6. l:longword;
  7. m:longword;
  8. h:longword;
  9. end;
  10. var
  11. l,
  12. m,
  13. moffs,
  14. h: longword;
  15. test:br;
  16. {$asmmode att}
  17. begin
  18. with test do
  19. begin
  20. l:=4;
  21. m:=8;
  22. h:=$f
  23. end;
  24. asm
  25. movl br.m,%eax //eax should be 4,but it is 32. Eight times. error!
  26. movl %eax, moffs
  27. movl test.m,%eax //eax should be 8,but it is, a strange number. error!
  28. movl %eax, m
  29. movl test.l,%eax
  30. movl %eax, l
  31. movl test.h,%eax
  32. movl %eax, h
  33. end;
  34. if (moffs<>4) then
  35. halt(1);
  36. if (m<>8) then
  37. halt(2);
  38. if (l<>4) then
  39. halt(3);
  40. if (h<>$f) then
  41. halt(4);
  42. end.