mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-01-07 12:00:36 +01:00
* fixed overflow for constant in-expressions involving values >
high(uinttype) on the left side git-svn-id: trunk@6852 -
This commit is contained in:
parent
ac585ea201
commit
f63b0ef160
@ -286,8 +286,17 @@ implementation
|
||||
begin
|
||||
if (right.nodetype=setconstn) then
|
||||
begin
|
||||
t:=cordconstnode.create(byte(tordconstnode(left).value in Tsetconstnode(right).value_set^),
|
||||
booltype,true);
|
||||
{ tordconstnode.value is int64 -> signed -> the expression }
|
||||
{ below will be converted to longint on 32 bit systems due }
|
||||
{ to the rule above -> will give range check error if }
|
||||
{ value > high(longint) if we don't take the signedness }
|
||||
{ into account }
|
||||
if is_signed(left.resultdef) then
|
||||
t:=cordconstnode.create(byte(tordconstnode(left).value in Tsetconstnode(right).value_set^),
|
||||
booltype,true)
|
||||
else
|
||||
t:=cordconstnode.create(byte(TConstExprUInt(tordconstnode(left).value) in Tsetconstnode(right).value_set^),
|
||||
booltype,true);
|
||||
typecheckpass(t);
|
||||
result:=t;
|
||||
exit;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user