tb0528.pp 737 B

12345678910111213141516171819202122232425262728
  1. {%CPU=x86_64,ppc64}
  2. program tb0528;
  3. {This program tests if huge arrays work on 64-bit systems. I got the idea
  4. testing this because today I had a Fortran program that didn't work. After
  5. inspection it appeared the mad scientist was using arrays > 2GB.
  6. So, I did a test how well FPC handled such code. Disappointment, FPC
  7. did generate wrong code.
  8. Note that this test does not use huge amounts of memory, as the operating
  9. system should allocate a page on write.
  10. does not get allocated.}
  11. type huge_array=array[0..$ffffffff] of word;
  12. var a,b,c:huge_array;
  13. begin
  14. a[$ffffffff]:=1;
  15. b[$ffffffff]:=2;
  16. c[$ffffffff]:=3;
  17. if a+b+c<>6 then
  18. halt(1);
  19. writeln(a[$ffffffff]);
  20. writeln(b[$ffffffff]);
  21. writeln(c[$ffffffff]);
  22. end.