ref: d9a91fc895bc8f8df0469e80374d8160c0e13bb8
parent: 6a4040c99ee0127808d77ad2dc38220f1a8a1c46
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Sep 29 04:45:17 EDT 2015
Fix cast checks. We used some casting slices to intptrs when we implemented syscalls.
--- a/6/simp.c
+++ b/6/simp.c
@@ -933,7 +933,8 @@
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;