fpc/tests/tbs/tb0533.pp
Jonas Maebe 69cf42c4f7 * fixed val(s,int64) (it accepted values in the range
high(int64+1)..high(qword) if written in decimal notation) + test
  * fixed range checking of qword constants parsed by the compiler
    (they always gave a range error if > high(int64), because the compiler
     internally stores them as int64)
  * turn off range checking flag of rdconstnodes created by the parser
    from _INTCONST, because those are already range checked by the
    way they are parsed using val()

git-svn-id: trunk@6814 -
2007-03-12 22:22:43 +00:00

26 lines
459 B
ObjectPascal

{$r+}
const
q: qword = 18446744073709551615;
var
i: int64;
code: longint;
begin
val('18446744073709551615',i,code);
if (code = 0) then
halt(1);
val('-9223372036854775808',i,code);
if (code <> 0) or
(i <> low(int64)) then
halt(2);
val('9223372036854775807',i,code);
if (code <> 0) or
(i <> high(int64)) then
halt(3);
val('$8000000000000000',i,code);
if (code <> 0) or
(i <> low(int64)) then
halt(4);
end.