taoc6.pp 967 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. { %cpu=i386 }
  2. { This test expects values on the stack, which is i386 only }
  3. { sixth simple array of const test
  4. for int64 values }
  5. {$mode objfpc}
  6. program test_cdecl_array_of_const;
  7. type
  8. pint64 = ^int64;
  9. var
  10. l : int64;
  11. const
  12. has_errors : boolean = false;
  13. procedure test_one_int64(args : array of const);cdecl;
  14. var
  15. p : pint64;
  16. begin
  17. p:=pint64(@args);
  18. l:=p^;
  19. end;
  20. procedure test_two_int64(args : array of const);cdecl;
  21. var
  22. p : pint64;
  23. begin
  24. p:=pint64(@args);
  25. inc(pointer(p),sizeof(int64));
  26. l:=p^;
  27. end;
  28. var
  29. i,j : int64;
  30. begin
  31. i:=$65ffffff;
  32. i:=i*5698;
  33. j:=2*i;
  34. test_one_int64([i]);
  35. if l<>i then
  36. has_errors:=true;
  37. l:=4;
  38. test_one_int64([j,i]);
  39. if l<>j then
  40. has_errors:=true;
  41. l:=4;
  42. test_one_int64([i+j,i,j]);
  43. if l<>i+j then
  44. has_errors:=true;
  45. l:=4;
  46. test_two_int64([i+j,j-i]);
  47. if l<>j-i then
  48. has_errors:=true;
  49. if has_errors then
  50. begin
  51. Writeln('cdecl array of const problem for int64');
  52. halt(1);
  53. end;
  54. end.