* fix try_make_mul32to64() if it's called with a constant node on the

left (mantis #37878)
   o can happen if use_generic_mul32to64 returns false

git-svn-id: trunk@47142 -
This commit is contained in:
Jonas Maebe 2020-10-19 19:10:16 +00:00
parent 0e474f4748
commit 099134b545
3 changed files with 13 additions and 5 deletions

1
.gitattributes vendored
View File

@ -18493,6 +18493,7 @@ tests/webtbs/tw37806.pp svneol=native#text/pascal
tests/webtbs/tw3782.pp svneol=native#text/plain
tests/webtbs/tw37823.pp svneol=native#text/pascal
tests/webtbs/tw37844.pp svneol=native#text/pascal
tests/webtbs/tw37878.pp svneol=native#text/plain
tests/webtbs/tw37926.pp svneol=native#text/pascal
tests/webtbs/tw3796.pp svneol=native#text/plain
tests/webtbs/tw3805.pp svneol=native#text/plain

View File

@ -3572,6 +3572,9 @@ implementation
canbesignedconst, canbeunsignedconst: boolean;
begin
result := false;
{ make sure that if there is a constant, that it's on the right }
if left.nodetype = ordconstn then
swapleftright;
if is_32to64typeconv(left) then
begin
leftoriginallysigned:=is_signed(ttypeconvnode(left).left.resultdef);
@ -3747,11 +3750,7 @@ implementation
{ make sure that if there is a constant, that it's on the right }
if left.nodetype = ordconstn then
begin
temp := right;
right := left;
left := temp;
end;
swapleftright;
{ can we use a shift instead of a mul? }
if not (cs_check_overflow in current_settings.localswitches) and

8
tests/webtbs/tw37878.pp Normal file
View File

@ -0,0 +1,8 @@
{$mode objfpc}
var i64: int64; w: word;
begin
{$Q+}
w := 4096;
i64 := 8191;
i64 := i64 - 2*int64(w);
end.