tnostackframe2.pp 523 B

123456789101112131415161718192021222324
  1. { %fail }
  2. {%opt=-O- }
  3. { This function defines a local var which needs stack space,
  4. so nostackframe should always be invalid.
  5. -O- option used because with -O3 both result
  6. and x variable can be regvars, so that there is no error! }
  7. function test : longint; nostackframe;
  8. var
  9. x : longint;
  10. begin
  11. x:=4;
  12. test:=5*x;
  13. end;
  14. begin
  15. if test<>20 then
  16. begin
  17. writeln('Wrong result in nostackframe non-assembler function');
  18. halt(1);
  19. end
  20. else
  21. writeln('Pascal function nostackframe works OK');
  22. end.