Don't fall through after optimizing a negable comparison, as it's folded already and the variables were incorrectly set and broke our invariants.

This commit is contained in:
Sei Lisa 2015-04-21 06:09:57 +02:00
parent d58bc2d350
commit 4302ea846d

View file

@ -769,9 +769,9 @@ class foldconst(object):
# the number of cases to check.
# a<=b --> !(a>b); a>=b --> !(a<b); a!=b --> !(a==b)
node['nt'] = {'<=':'>', '>=':'<', '!=':'=='}[nt]
node = parent[index] = {'nt':'!', 't':node['t'], 'ch':[node]}
parent[index] = {'nt':'!', 't':node['t'], 'ch':[node]}
self.FoldTree(parent, index)
# Fall through to optimize as '<' or '>' or '=='
return
if nt == '>':
# Invert the inequalities to avoid doubling the cases to check.