Commit d116a327 authored by Russ Cox's avatar Russ Cox

gc: reject large channel values at compile time

Fixes #144.

R=ken2
CC=agl1
https://golang.org/cl/156102
parent a6e1ad27
......@@ -186,6 +186,18 @@ dowidth(Type *t)
case TCHAN: // implemented as pointer
w = widthptr;
checkwidth(t->type);
// make fake type to check later to
// trigger channel argument check.
t1 = typ(TCHANARGS);
t1->type = t;
checkwidth(t1);
break;
case TCHANARGS:
t1 = t->type;
dowidth(t->type); // just in case
if(t1->type->width >= (1<<16))
yyerror("channel element type too large (>64kB)");
break;
case TMAP: // implemented as pointer
w = widthptr;
......
......@@ -441,6 +441,7 @@ enum
// pseudo-type for frame layout
TFUNCARGS,
TCHANARGS,
NTYPE,
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment