mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-14 04:59:26 +01:00
* inc(x,y) makes y always of type x to prevent 64bit operations
when x is a u32bit and y is signed
This commit is contained in:
parent
07c67967cf
commit
13ee9660a4
@ -1695,26 +1695,7 @@ implementation
|
|||||||
if assigned(tcallparanode(left).right) then
|
if assigned(tcallparanode(left).right) then
|
||||||
begin
|
begin
|
||||||
set_varstate(tcallparanode(tcallparanode(left).right).left,vs_used,true);
|
set_varstate(tcallparanode(tcallparanode(left).right).left,vs_used,true);
|
||||||
if (aktlocalswitches *
|
inserttypeconv_explicit(tcallparanode(tcallparanode(left).right).left,tcallparanode(left).left.resulttype);
|
||||||
[cs_check_overflow,cs_check_range] = []) then
|
|
||||||
begin
|
|
||||||
{ insert a type conversion }
|
|
||||||
{ the second param is always longint }
|
|
||||||
if is_currency(left.resulttype.def) then
|
|
||||||
inserttypeconv(tcallparanode(tcallparanode(left).right).left,s64currencytype)
|
|
||||||
else
|
|
||||||
if is_64bitint(left.resulttype.def) then
|
|
||||||
if is_signed(left.resulttype.def) then
|
|
||||||
inserttypeconv(tcallparanode(tcallparanode(left).right).left,s64inttype)
|
|
||||||
else
|
|
||||||
inserttypeconv(tcallparanode(tcallparanode(left).right).left,u64inttype)
|
|
||||||
else
|
|
||||||
if is_signed(left.resulttype.def) then
|
|
||||||
inserttypeconv(tcallparanode(tcallparanode(left).right).left,s32inttype)
|
|
||||||
else
|
|
||||||
inserttypeconv(tcallparanode(tcallparanode(left).right).left,u32inttype);
|
|
||||||
end;
|
|
||||||
|
|
||||||
if assigned(tcallparanode(tcallparanode(left).right).right) then
|
if assigned(tcallparanode(tcallparanode(left).right).right) then
|
||||||
CGMessage(cg_e_illegal_expression);
|
CGMessage(cg_e_illegal_expression);
|
||||||
end;
|
end;
|
||||||
@ -2124,14 +2105,18 @@ implementation
|
|||||||
expectloc:=LOC_VOID;
|
expectloc:=LOC_VOID;
|
||||||
|
|
||||||
{ check type }
|
{ check type }
|
||||||
if is_64bit(left.resulttype.def) or
|
if
|
||||||
|
{$ifndef cpu64bit}
|
||||||
|
is_64bit(left.resulttype.def) or
|
||||||
|
{$endif cpu64bit}
|
||||||
{ range/overflow checking doesn't work properly }
|
{ range/overflow checking doesn't work properly }
|
||||||
{ with the inc/dec code that's generated (JM) }
|
{ with the inc/dec code that's generated (JM) }
|
||||||
((left.resulttype.def.deftype = orddef) and
|
(
|
||||||
|
(left.resulttype.def.deftype = orddef) and
|
||||||
not(is_char(left.resulttype.def)) and
|
not(is_char(left.resulttype.def)) and
|
||||||
not(is_boolean(left.resulttype.def)) and
|
not(is_boolean(left.resulttype.def)) and
|
||||||
(aktlocalswitches *
|
(aktlocalswitches * [cs_check_overflow,cs_check_range] <> [])
|
||||||
[cs_check_overflow,cs_check_range] <> [])) then
|
) then
|
||||||
{ convert to simple add (JM) }
|
{ convert to simple add (JM) }
|
||||||
begin
|
begin
|
||||||
{ extra parameter? }
|
{ extra parameter? }
|
||||||
@ -2145,7 +2130,7 @@ implementation
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
{ no, create constant 1 }
|
{ no, create constant 1 }
|
||||||
hpp := cordconstnode.create(1,s32inttype,false);
|
hpp := cordconstnode.create(1,tcallparanode(left).left.resulttype,false);
|
||||||
{ addition/substraction depending on inc/dec }
|
{ addition/substraction depending on inc/dec }
|
||||||
if inlinenumber = in_inc_x then
|
if inlinenumber = in_inc_x then
|
||||||
hp := caddnode.create(addn,tcallparanode(left).left.getcopy,hpp)
|
hp := caddnode.create(addn,tcallparanode(left).left.getcopy,hpp)
|
||||||
@ -2374,7 +2359,11 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.134 2004-05-23 18:28:41 peter
|
Revision 1.135 2004-05-28 21:15:20 peter
|
||||||
|
* inc(x,y) makes y always of type x to prevent 64bit operations
|
||||||
|
when x is a u32bit and y is signed
|
||||||
|
|
||||||
|
Revision 1.134 2004/05/23 18:28:41 peter
|
||||||
* methodpointer is loaded into a temp when it was a calln
|
* methodpointer is loaded into a temp when it was a calln
|
||||||
|
|
||||||
Revision 1.133 2004/03/18 16:19:03 peter
|
Revision 1.133 2004/03/18 16:19:03 peter
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user