* fix tw8191 for all architectures: skip code generation for range checking also when the range checking has to be done dynamically for pointers accessed as arrays which were typecasted from an array

git-svn-id: trunk@11037 -
This commit is contained in:
tom_at_work 2008-05-22 12:52:26 +00:00
parent d79851dc1b
commit 4aced9802c

View File

@ -718,29 +718,33 @@ implementation
case left.resultdef.typ of case left.resultdef.typ of
arraydef : arraydef :
begin begin
if not(is_open_array(left.resultdef)) and { do not do any range checking when this is an array access to a pointer which has been
not(is_array_of_const(left.resultdef)) and typecasted from an array }
not(is_dynamic_array(left.resultdef)) and if (not (ado_isconvertedpointer in tarraydef(left.resultdef).arrayoptions)) then
not(ado_isconvertedpointer in tarraydef(left.resultdef).arrayoptions) then begin
begin if not(is_open_array(left.resultdef)) and
if (tordconstnode(right).value.svalue>tarraydef(left.resultdef).highrange) or not(is_array_of_const(left.resultdef)) and
(tordconstnode(right).value.svalue<tarraydef(left.resultdef).lowrange) then not(is_dynamic_array(left.resultdef)) then
begin begin
{ this should be caught in the typecheckpass! (JM) } if (tordconstnode(right).value.svalue>tarraydef(left.resultdef).highrange) or
(tordconstnode(right).value.svalue<tarraydef(left.resultdef).lowrange) then
begin
{ this should be caught in the typecheckpass! (JM) }
if (cs_check_range in current_settings.localswitches) then
CGMessage(parser_e_range_check_error)
else
CGMessage(parser_w_range_check_error);
end;
end
else
begin
{ range checking for open and dynamic arrays needs
runtime code }
secondpass(right);
if (cs_check_range in current_settings.localswitches) then if (cs_check_range in current_settings.localswitches) then
CGMessage(parser_e_range_check_error) rangecheck_array;
else end;
CGMessage(parser_w_range_check_error); end;
end;
end
else
begin
{ range checking for open and dynamic arrays needs
runtime code }
secondpass(right);
if (cs_check_range in current_settings.localswitches) then
rangecheck_array;
end;
end; end;
stringdef : stringdef :
begin begin