case bugFomin Pavel
Original Reporter info from Mantis: FPCCore
-
Reporter name: FPC core team
Original Reporter info from Mantis: FPCCore
- Reporter name: FPC core team
Description:
FPC v0.99.12, win32
Incorrect optimization in "speed" mode (-Og), -OG is OK!
The FPC incorrectly compiled function "StrCom" (It causes RE216 (GPF), when
called as StrCom('-','+')).
Source code:
===============
function StrCom(const s1,s2:string):Integer;
function sign1(x:integer):integer;
begin
if x=0 then Sign1:=0 else
if x>0 then Sign1:=1 else
if x<0 then Sign1:=-1;
end;
var i:integer;
begin
StrCom:=0;
for i:=1 to IMin(length(s1),length(s2)) do
case Sign1(byte(s1[i])-byte(s2[i])) of
-1: begin
StrCom:=-1;
exit;
end;
0: ;
+1: begin
StrCom:=1;
exit;
end;
end;
StrCom:=Sign1(length(s2)-length(s1));
end;
===============
Additional information:
Reporter: Fomin Pavel
EMail: vostok at indi dot ru
Mantis conversion info:
- Mantis ID: 2513
- OS: GO32V2
- Version: ?
- Fixed in version: 0.99.13