tw17283.pp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. {$mode objfpc}
  2. program test;
  3. type
  4. tr_32=packed record
  5. case integer of
  6. 1: (words: array [0..1] of word);
  7. 2: (low,high: word);
  8. end;
  9. (*
  10. procedure f_ref(var l,h:word);
  11. begin
  12. l:=1;
  13. h:=2;
  14. end;
  15. function f_test1:longint;
  16. begin
  17. result:=$12345678;
  18. f_ref(tr_32(result).words[0],tr_32(result).words[1]);
  19. end;
  20. function f_test2:longint;
  21. begin
  22. result:=$12345678;
  23. f_ref(tr_32(result).low,tr_32(result).high);
  24. end;
  25. function f_test3:longint;
  26. var
  27. q: longint;
  28. begin
  29. q:=$12345678;
  30. f_ref(tr_32(q).words[0],tr_32(q).words[1]);
  31. result:=q;
  32. end;
  33. *)
  34. function f_test4:longint;
  35. var
  36. q: longint;
  37. begin
  38. q:=$12345678;
  39. tr_32(q).words[0]:=1;
  40. tr_32(q).words[1]:=2;
  41. result:=q;
  42. end;
  43. var
  44. l,q: longint;
  45. begin
  46. (*
  47. l:=f_test1;
  48. if (tr_32(l).low<>1) or
  49. (tr_32(l).high<>2) then
  50. halt(1);
  51. l:=f_test2;
  52. if (tr_32(l).low<>1) or
  53. (tr_32(l).high<>2) then
  54. halt(2);
  55. q:=$12345678;
  56. f_ref(tr_32(q).words[0],tr_32(q).words[1]);
  57. if (tr_32(q).low<>1) or
  58. (tr_32(q).high<>2) then
  59. halt(3);
  60. q:=$12345678;
  61. f_ref(tr_32(q).low,tr_32(q).high);
  62. if (tr_32(q).low<>1) or
  63. (tr_32(q).high<>2) then
  64. halt(4);
  65. l:=f_test3;
  66. if (tr_32(l).low<>1) or
  67. (tr_32(l).high<>2) then
  68. halt(5);
  69. *)
  70. l:=f_test4;
  71. if (tr_32(l).low<>1) or
  72. (tr_32(l).high<>2) then
  73. halt(6);
  74. end.