tb0508.pp 765 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. { inlining is not compatible with get_caller_frame/get_frame }
  2. {$inline off}
  3. {$ifndef cpullvm}
  4. type
  5. PointerLocal = procedure(_EBP: Pointer);
  6. procedure proccall(p: codepointer);
  7. begin
  8. {$ifndef FPC_LOCALS_ARE_STACK_REG_RELATIVE}
  9. PointerLocal(p)(get_caller_frame(get_frame,get_pc_addr));
  10. {$else}
  11. PointerLocal(p)(get_frame);
  12. {$endif}
  13. end;
  14. procedure t1;
  15. var
  16. l : longint;
  17. procedure t2;
  18. procedure t3;
  19. procedure t4;
  20. begin
  21. l := 5;
  22. end;
  23. begin { t3 }
  24. proccall(@t4);
  25. end;
  26. begin { t2 }
  27. t3;
  28. end;
  29. begin { t1 }
  30. l := 0;
  31. t2;
  32. if (l <> 5) then
  33. halt(1);
  34. end;
  35. begin
  36. t1;
  37. end.
  38. {$else ndef cpullvm}
  39. begin
  40. { this kind of hacks can never work on llvm }
  41. end.
  42. {$endif cpullvm}