[fpc-devel] extend "unreachable code" warning for more cases?

Sven Barth pascaldragon at googlemail.com
Wed Feb 26 09:09:29 CET 2014


Hello together!

In context of Apple's recent security bug where a "goto fail;" at the 
wrong place disabled certificate checking or something along that lines 
I've thought whether it would 1) be worthwhile to extend FPC with the 
capability to detect such cases as well and 2) to see whether it would 
be currently feasible at all.

So, how hard would it be to let the compiler detect cases like these:

=== code begin ===

procedure Test1;
begin
   Writeln('Test1');
   Exit;
   Writeln('Test1');
end;

procedure Test2;
label
   stop;
begin
   Writeln('Test2');
   goto stop;
   Writeln('Test2');
stop:
end;

=== code end ===

and of course potentially more complex ones...

Also would you think it would be worthwhile to spend time on this?

Regards,
Sven



More information about the fpc-devel mailing list