"for ... downto ..." loop is unrolled incorrectly (if -OoLOOPUNROLL is passed to compiler)
Original Reporter info from Mantis: SIV
-
Reporter name: Igor Sudarikov
Original Reporter info from Mantis: SIV
- Reporter name: Igor Sudarikov
Description:
Program provided in "additional information" crashes at runtime because loop body is executed with loop variable values 1,2 instead of 1,0
Additional information:
const
StrArray :array[0..1] of string = ('s1','s2');
function FindStr(const s :string) :Integer;
var
i :Integer;
begin
for i := High(StrArray) downto 0 do
if StrArray[i] = s then Exit(i);
Result := -1;
end;
begin
FindStr('s1');
end.
Mantis conversion info:
- Mantis ID: 15668
- Version: 2.5.1
- Fixed in version: 2.6.0
- Fixed in revision: 14884 (#092153e7)