|
@@ -2310,7 +2310,11 @@ implementation
|
|
|
|
|
|
{ range/overflow checking doesn't work properly }
|
|
|
{ with the inc/dec code that's generated (JM) }
|
|
|
- if (current_settings.localswitches * [cs_check_overflow,cs_check_range] <> []) then
|
|
|
+ if (current_settings.localswitches * [cs_check_overflow,cs_check_range] <> []) and
|
|
|
+ { No overflow check for pointer operations, because inc(pointer,-1) will always
|
|
|
+ trigger an overflow. For uint32 it works because then the operation is done
|
|
|
+ in 64bit. Range checking is not applicable to pointers either }
|
|
|
+ (tcallparanode(left).left.resultdef.typ<>pointerdef) then
|
|
|
{ convert to simple add (JM) }
|
|
|
begin
|
|
|
newblock := internalstatements(newstatement);
|
|
@@ -2337,11 +2341,6 @@ implementation
|
|
|
(torddef(hpp.resultdef).ordtype<>u64bit)) then
|
|
|
{$endif not cpu64bit}
|
|
|
inserttypeconv_internal(hpp,sinttype);
|
|
|
- { No overflow check for pointer operations, because inc(pointer,-1) will always
|
|
|
- trigger an overflow. For uint32 it works because then the operation is done
|
|
|
- in 64bit }
|
|
|
- if (tcallparanode(left).left.resultdef.typ=pointerdef) then
|
|
|
- exclude(current_settings.localswitches,cs_check_overflow);
|
|
|
{ make sure we don't call functions part of the left node twice (and generally }
|
|
|
{ optimize the code generation) }
|
|
|
if node_complexity(tcallparanode(left).left) > 1 then
|
|
@@ -2361,8 +2360,7 @@ implementation
|
|
|
|
|
|
resultnode := hp.getcopy;
|
|
|
{ avoid type errors from the addn/subn }
|
|
|
- if not is_integer(resultnode.resultdef) and
|
|
|
- (resultnode.resultdef.typ <> pointerdef) then
|
|
|
+ if not is_integer(resultnode.resultdef) then
|
|
|
begin
|
|
|
inserttypeconv_internal(hp,sinttype);
|
|
|
inserttypeconv_internal(hpp,sinttype);
|
|
@@ -2374,8 +2372,7 @@ implementation
|
|
|
else
|
|
|
hpp := caddnode.create(subn,hp,hpp);
|
|
|
{ assign result of addition }
|
|
|
- if not(is_integer(resultnode.resultdef)) and
|
|
|
- (resultnode.resultdef.typ <> pointerdef) then
|
|
|
+ if not(is_integer(resultnode.resultdef)) then
|
|
|
inserttypeconv(hpp,torddef.create(
|
|
|
{$ifdef cpu64bit}
|
|
|
s64bit,
|