summaryrefslogtreecommitdiff
path: root/parse
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2012-07-27 01:32:42 -0400
committerOri Bernstein <ori@eigenstate.org>2012-07-27 01:32:42 -0400
commit18ad8af1fb596563dcc32e618f46b454efb94f75 (patch)
tree59cd4bc30c3b40a8551df5d39fecd1a3ac8f3cdb /parse
parentda885b02dd6178dd20ba7929b1d62aa07c0cfe8d (diff)
downloadmc-18ad8af1fb596563dcc32e618f46b454efb94f75.tar.gz
Make truncating casts not broken.
Diffstat (limited to 'parse')
-rw-r--r--parse/gram.y2
-rw-r--r--parse/infer.c1
-rw-r--r--parse/ops.def3
3 files changed, 6 insertions, 0 deletions
diff --git a/parse/gram.y b/parse/gram.y
index 2eaaa69..98d955a 100644
--- a/parse/gram.y
+++ b/parse/gram.y
@@ -441,6 +441,8 @@ unionexpr
borexpr : borexpr Tbor bandexpr
{$$ = mkexpr($1->line, binop($2->type), $1, $3, NULL);}
+ | borexpr Tbxor bandexpr
+ {$$ = mkexpr($1->line, binop($2->type), $1, $3, NULL);}
| bandexpr
;
diff --git a/parse/infer.c b/parse/infer.c
index 14a352c..c86333c 100644
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -664,6 +664,7 @@ static void inferexpr(Inferstate *st, Node *n, Type *ret, int *sawret)
case Oload: case Ostor: case Oset:
case Oslbase: case Osllen:
case Oblit: case Numops:
+ case Otrunc: case Oswiden: case Ozwiden:
die("Should not see %s in fe", opstr(exprop(n)));
break;
}
diff --git a/parse/ops.def b/parse/ops.def
index 38bcb8a..05b65c5 100644
--- a/parse/ops.def
+++ b/parse/ops.def
@@ -59,3 +59,6 @@ O(Oset, 1) /* store to var */
O(Osllen, 1) /* size of slice */
O(Oslbase, 1) /* base of sice */
O(Oblit, 1) /* block copy of memory */
+O(Otrunc, 1) /* truncating cast */
+O(Ozwiden, 1) /* zero-extending widening cast */
+O(Oswiden, 1) /* sign-extending widening cast */