tb0118.pp 782 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. { Old file: tbs0138.pp }
  2. { with problem, %esi can be crushed and is not restored OK 0.99.6 (PM) }
  3. {program p; uncomment for a crash}
  4. type
  5. tpt=^tpo;
  6. tpo=object
  7. constructor init;
  8. procedure pi1;
  9. procedure pi2;
  10. end;
  11. constructor tpo.init;
  12. begin
  13. end;
  14. procedure tpo.pi1;
  15. begin
  16. end;
  17. procedure tpo.pi2;
  18. begin
  19. end;
  20. procedure crushesi;assembler;
  21. {$ifdef CPUI386}
  22. asm
  23. movl %eax,%esi
  24. end ['EAX','ESI'];
  25. {$endif CPUI386}
  26. {$ifdef CPU68K}
  27. asm
  28. move.l d0,a5
  29. end ['d0','a5'];
  30. {$endif CPU68K}
  31. var
  32. p1 : tpt;
  33. begin
  34. p1:=new(tpt,init);
  35. with p1^ do
  36. begin
  37. pi1;
  38. crushesi; { After this the %esi should be reloaded from the tempvariable }
  39. pi1;
  40. end;
  41. { There is here already a tempvar for %esi, why not use it here too ? }
  42. p1^.pi2;
  43. p1^.pi2;
  44. end.