* PopCount takes care only of the bit pattern, so take the uvalue to avoid an internal error, resolves #40190

This commit is contained in:
florian 2023-03-17 22:30:36 +01:00
parent 98fa292b20
commit 64319dc019
2 changed files with 13 additions and 1 deletions

View File

@ -1833,7 +1833,8 @@ implementation
t:=nil;
cr:=0;
end;
if (t<>nil) and (PopCnt(cr) = 1) then
{ using cr.uvalue is fine as we are interested only in the bit pattern }
if (t<>nil) and (PopCnt(cr.uvalue) = 1) then
begin
if is_constintnode(taddnode(t).left) then
vl:=taddnode(t).left

11
tests/webtbs/tw40190.pp Normal file
View File

@ -0,0 +1,11 @@
{ %opt=-O2 }
{ %norun }
function InternalInt64ToInt8(Value: Int64; Dest: IntPtr; IgnoreConvertErrors: Boolean): Boolean;
begin
if (Value and $FFFFFFFFFFFFFF80 <> 0) and (Value and $FFFFFFFFFFFFFF80 <> $FFFFFFFFFFFFFF80) then begin
// remainder not relevant
end;
end;
begin
end.