[fpc-devel] Data flow analysis (dfa) and "case ... of"

Juha Manninen juha.manninen62 at gmail.com
Mon Jun 5 23:11:58 CEST 2017


On Mon, Jun 5, 2017 at 9:37 PM, Denis Kozlov <dezlov at gmail.com> wrote:
> I just wanted to highlight that these cases as legal and I presume not
> uncommon, particularly if values are deserialized and typecasted.

No they are not legal. Why you write this nonsense?
Values outside the range dictated by the type system are always wrong.
No excuses, no exceptions.
For the purposes of DFA the compiler can always assume the values are in range.

- Later: -
> Complier currently warns (cares) about such execution flows
> which are triggered by invalid data, and I happen to find it useful :)

Again nonsense.
The range check -Cr warns about out-of-range data, yes, but this
thread is about DFA and not about range checks.
I feel you hijacked my DFA thread for your own purpose but I don't
really know what that purpose is.
Are you saying that typecasts should be forbidden to prevent range errors?
No, it would not prevent bugs in code.
Anyway, please start a new thread about range check issues.

Juha



More information about the fpc-devel mailing list