{$ELSE } without mathing {$IFDEF ... } is giving invalid subscript .
Original Reporter info from Mantis: sanliturk
-
Reporter name: Mehmet Erol Sanliturk
Original Reporter info from Mantis: sanliturk
- Reporter name: Mehmet Erol Sanliturk
Description:
In the unit :
http://svn.freepascal.org/svn/fpc/trunk/compiler/options.pas
in the :
procedure Toption.Interpret_file(const filename : string);
there are the following declarations :
skip : array[0..maxlevel-1] of boolean;
level : longint;
and with intitial value :
level:=0;
When an {$ELSE } statement is seen without matching
{$IFDEF ... }
the following part is giving
skip [ 0 ] := skip [ -1 ] ...
where skip [ -1 ] is undefined :
else
if (s='ELSE') then
skip[level]:=skip[level-1] or (not skip[level])
else
A change like the following possible one should be applied :
else
if (s='ELSE') then
if Level=0 then
begin
{ Message "ELSE without matching IFDEF" }
{ ... }
end
else
begin
skip[level]:=skip[level-1] or (not skip[level]) ;
end
else
Mantis conversion info:
- Mantis ID: 12365
- Fixed in version: 2.2.4
- Fixed in revision: 12072 (#b0f1fd2f)