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

Martok listbox at martoks-place.de
Sat Jul 1 16:45:43 CEST 2017


The attitude displayed over on #32079 is, quite frankly, terrifying. Apparently
a language which from the beginning has intrinsics for reading and writing files
must never be used for doing so, or wild things may happen /and that's okay/.

Implying that input should already be sanitized on a bug about something that
breaks input sanitation code (but only sometimes) is just... wow.

If anybody wants it, here's the patch I'll be rolling on the windows snapshots
from now on.


Have a good weekend,
Martok
-------------- next part --------------
Index: compiler/ncgset.pas
===================================================================
--- compiler/ncgset.pas	(revision 36620)
+++ compiler/ncgset.pas	(working copy)
@@ -1080,7 +1080,7 @@
                    labelcnt:=case_count_labels(labels);
                    { can we omit the range check of the jump table ? }
                    getrange(left.resultdef,lv,hv);
-                   jumptable_no_range:=(lv=min_label) and (hv=max_label);
+                   jumptable_no_range:=(lv=min_label) and (hv=max_label) and (cs_opt_level4 in current_settings.optimizerswitches) and not (cs_check_range in current_settings.localswitches);
                    { hack a little bit, because the range can be greater }
                    { than the positive range of a aint            }
 


More information about the fpc-devel mailing list