[fpc-devel] extend "unreachable code" warning for more cases?
sergei_gorelkin at mail.ru
Wed Feb 26 09:41:11 CET 2014
26.02.2014 12:09, Sven Barth пишет:
> 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;
> procedure Test2;
> goto stop;
> === code end ===
> and of course potentially more complex ones...
> Also would you think it would be worthwhile to spend time on this?
The definite assignment analysis ported by me four years ago
(http://bugs.freepascal.org/view.php?id=15523) detects all cases of unreachable code, except
backward goto's. Everything but backward goto's is almost trivial, backward goto's are more
complicated because they require multiple iterations over code tree, but are certainly feasible.
More information about the fpc-devel