[fpc-devel] Dangerous optimization in CASE..OF

Florian Klämpfl florian at freepascal.org
Sat Jul 15 21:31:36 CEST 2017


Am 15.07.2017 um 17:17 schrieb Martok:
> Several different ways of writing the (apparent) tautology "is EnumVar in
> Low(EnumType)..High(EnumType)" all handle out-of-range-values (expressly, not as
> a side effect of something else). 

... only because nobody implemented such an optimization yet.

> Which is especially noteworthy because with
> strict enums, we might as well drop the elseblock entirely and warn "unreachable
> code" in these tests.

Yes, FPC does this for subrange types, see e.g. https://bugs.freepascal.org/view.php?id=16006




More information about the fpc-devel mailing list