tb0168.pp 860 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. { %OPT= -Ratt }
  2. { Old file: tbs0201.pp }
  3. { problem with record var-parameters and assembler OK 0.99.11 (PFV) }
  4. program bug0201;
  5. type rec = record
  6. a : DWord;
  7. b : Word;
  8. end;
  9. { this is really for tests but
  10. this should be coded with const r1 and r2 !! }
  11. function x(r1 : rec; r2 : rec; var r3 : rec) : integer; assembler;
  12. asm
  13. movl r3, %edi
  14. movl r1, %ebx
  15. movl r2, %ecx
  16. movl rec.a(%ebx), %eax
  17. addl rec.a(%ecx), %eax
  18. movl %eax, rec.a(%edi)
  19. movw rec.b(%ebx), %ax
  20. addw rec.b(%ecx), %ax
  21. movw %ax, rec.b(%edi)
  22. movw $1,%ax
  23. end;
  24. var r1, r2, r3 : rec;
  25. begin
  26. r1.a := 100; r1.b := 200;
  27. r2.a := 300; r2.b := 400;
  28. x(r1, r2, r3);
  29. Writeln(r3.a, ' ', r3.b);
  30. if (r3.a<>400) or (r3.b<>600) then
  31. begin
  32. Writeln('Error in assembler code');
  33. Halt(1);
  34. end;
  35. end.