summaryrefslogtreecommitdiff
path: root/6
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-09-29 08:45:17 -0700
committerOri Bernstein <ori@eigenstate.org>2015-09-29 08:45:17 -0700
commitd9a91fc895bc8f8df0469e80374d8160c0e13bb8 (patch)
tree3fdc67fa6d07eaef56b162c8b43493458bb87183 /6
parent6a4040c99ee0127808d77ad2dc38220f1a8a1c46 (diff)
downloadmc-d9a91fc895bc8f8df0469e80374d8160c0e13bb8.tar.gz
Fix cast checks.
We used some casting slices to intptrs when we implemented syscalls.
Diffstat (limited to '6')
-rw-r--r--6/simp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/6/simp.c b/6/simp.c
index c6db9b7..dadc28a 100644
--- a/6/simp.c
+++ b/6/simp.c
@@ -933,7 +933,8 @@ static Node *simpcast(Simp *s, Node *val, Type *to)
switch (t->type) {
/* ptr -> slice conversion is disallowed */
case Tyslice:
- if (to->type != Typtr)
+ /* FIXME: we should only allow casting to pointers. */
+ if (tysize(to) != Ptrsz)
fatal(val, "bad cast from %s to %s", tystr(exprtype(val)), tystr(to));
r = slicebase(s, val, NULL);
break;