summaryrefslogtreecommitdiff
path: root/opt
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2012-07-25 23:32:21 -0400
committerOri Bernstein <ori@eigenstate.org>2012-07-25 23:32:21 -0400
commitbf903ecaf5d7a182e7796acd727b54128c4ba20f (patch)
tree02c25dde1779a2aa2f0aa60ad04c4eb528cf3874 /opt
parent2ba584cf7da0ce23828e187cf22fcbe02d65f7cc (diff)
downloadmc-bf903ecaf5d7a182e7796acd727b54128c4ba20f.tar.gz
Get the rvals for the subexpressions of casts.
We weren't actually evaluating the rhs. This is bad.
Diffstat (limited to 'opt')
-rw-r--r--opt/fold.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/opt/fold.c b/opt/fold.c
index 04befa3..5a4eba0 100644
--- a/opt/fold.c
+++ b/opt/fold.c
@@ -53,13 +53,13 @@ Node *fold(Node *n)
if (!n)
return NULL;
- assert(n->type == Nexpr);
+ if (n->type != Nexpr)
+ return n;
+
r = NULL;
args = n->expr.args;
- if (exprop(n) != Ovar && exprop(n) != Ocjmp &&
- exprop(n) != Ojmp && exprop(n) != Olit)
- for (i = 0; i < n->expr.nargs; i++)
- args[i] = fold(args[i]);
+ for (i = 0; i < n->expr.nargs; i++)
+ args[i] = fold(args[i]);
switch (exprop(n)) {
case Ovar:
/* FIXME: chase small consts */