mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-03 16:17:21 +01:00
* keep type when removing "1*", resolves #38840
This commit is contained in:
parent
e97e27b8d5
commit
08050086b9
@ -827,7 +827,10 @@ implementation
|
||||
end
|
||||
|
||||
else if (tordconstnode(right).value = 1) and (nodetype=muln) then
|
||||
result := left.getcopy
|
||||
{ insert type conversion in case it is a 32*32 to 64 bit multiplication optimization,
|
||||
the type conversion does not hurt because it is normally removed later on
|
||||
}
|
||||
result := ctypeconvnode.create_internal(left.getcopy,resultdef)
|
||||
|
||||
else if (tordconstnode(right).value = -1) and (nodetype=muln) then
|
||||
result := ctypeconvnode.create_internal(cunaryminusnode.create(left.getcopy),left.resultdef)
|
||||
@ -895,7 +898,10 @@ implementation
|
||||
end
|
||||
|
||||
else if (tordconstnode(left).value = 1) and (nodetype=muln) then
|
||||
result := right.getcopy
|
||||
{ insert type conversion in case it is a 32*32 to 64 bit multiplication optimization,
|
||||
the type conversion does not hurt because it is normally removed later on
|
||||
}
|
||||
result := ctypeconvnode.create_internal(right.getcopy,resultdef)
|
||||
|
||||
else if (tordconstnode(left).value = -1) and (nodetype=muln) then
|
||||
result := ctypeconvnode.create_internal(cunaryminusnode.create(right.getcopy),right.resultdef)
|
||||
|
||||
16
tests/webtbs/tw38840.pp
Normal file
16
tests/webtbs/tw38840.pp
Normal file
@ -0,0 +1,16 @@
|
||||
{ %opt=-O4 -CriotR }
|
||||
|
||||
{$mode objfpc}
|
||||
|
||||
function f : integer;
|
||||
begin
|
||||
result:=1234;
|
||||
end;
|
||||
|
||||
var r, s, t, tablecols : integer;
|
||||
|
||||
begin
|
||||
s := 1;
|
||||
t := r + (s*tablecols);
|
||||
t := r + (s*tablecols);
|
||||
end.
|
||||
Loading…
Reference in New Issue
Block a user