tcint64.pp 958 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. { The results of the following constants
  2. differ on 1.0 and 1.1 compiler
  3. as constants are evaluated as 32bit integers in 1.1
  4. and as 64bit integers in 1.1
  5. But in all cases int64(-1) should give -1 and not $ffffffff PM }
  6. {$R-}
  7. const
  8. u1 : qword = $ffffffff;
  9. i1 : int64 = $ffffffff;
  10. u2 : qword = -1;
  11. i2 : int64 = -1;
  12. var
  13. l : longint;
  14. begin
  15. l:=-1;
  16. Writeln(' qword($ffffffff) = ',u1);
  17. Writeln(' int64($ffffffff) = ',i1);
  18. Writeln(' qword(-1) = ',u2);
  19. Writeln(' int64(-1) = ',i2);
  20. if i2<>-1 then
  21. begin
  22. Writeln('"const i2 : int64 = -1;" code');
  23. Writeln('generates a wrong int64 constant');
  24. RunError(1);
  25. end;
  26. if u2<>qword(int64(l)) then
  27. begin
  28. Writeln('"const u2 : qword = -1;" code');
  29. Writeln('generates a wrong int64 constant');
  30. RunError(1);
  31. end;
  32. if qword(l)<>u2 then
  33. begin
  34. writeln('qword(longint) sign extension generates wrong code');
  35. halt(1);
  36. end;
  37. end.