* avoid internalerror for dec/inc(...,v) with v>high(int64), resolves #35298

git-svn-id: trunk@44031 -
This commit is contained in:
florian 2020-01-24 21:39:07 +00:00
parent 993144b91b
commit 6c71fd461d
3 changed files with 20 additions and 1 deletions

1
.gitattributes vendored
View File

@ -17904,6 +17904,7 @@ tests/webtbs/tw3523.pp svneol=native#text/plain
tests/webtbs/tw35233.pp svneol=native#text/plain
tests/webtbs/tw35272.pp svneol=native#text/plain
tests/webtbs/tw3529.pp svneol=native#text/plain
tests/webtbs/tw35298.pp svneol=native#text/pascal
tests/webtbs/tw3531.pp svneol=native#text/plain
tests/webtbs/tw3533.pp svneol=native#text/plain
tests/webtbs/tw3534.pp svneol=native#text/plain

View File

@ -451,7 +451,9 @@ implementation
begin
{$if not defined(cpu64bitalu) and not defined(cpuhighleveltarget)}
if def_cgsize(left.resultdef) in [OS_64,OS_S64] then
cg64.a_op64_const_loc(current_asmdata.CurrAsmList,addsubop[inlinenumber],def_cgsize(left.resultdef),addvalue,tcallparanode(left).left.location)
{ use addvalue.svalue here to avoid an internal error if addvalue is unsigned and overflows int64, see #35298,
we are only interested in the bit pattern here }
cg64.a_op64_const_loc(current_asmdata.CurrAsmList,addsubop[inlinenumber],def_cgsize(left.resultdef),addvalue.svalue,tcallparanode(left).left.location)
else
{$endif not cpu64bitalu and not cpuhighleveltarget}
hlcg.a_op_const_loc(current_asmdata.CurrAsmList,addsubop[inlinenumber],left.resultdef,

16
tests/webtbs/tw35298.pp Normal file
View File

@ -0,0 +1,16 @@
{$MODE DELPHI}
{$RANGECHECKS OFF}
{$OVERFLOWCHECKS OFF}
function SplitMix64(var X: UInt64) : UInt64;
var
Z: UInt64;
begin
Inc(X, UInt64($9E3779B97F4A7C15));
Z := (X xor (X shr 30)) * UInt64($BF58476D1CE4E5B9);
Z := (Z xor (Z shr 27)) * UInt64($94D049BB133111EB);
Result := Z xor (Z shr 31);
end;
begin
end.