summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/cmd/cc/dcl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/src/cmd/cc/dcl.c b/sys/src/cmd/cc/dcl.c
index 968654165..7b2ae464f 100644
--- a/sys/src/cmd/cc/dcl.c
+++ b/sys/src/cmd/cc/dcl.c
@@ -381,8 +381,14 @@ init1(Sym *s, Type *t, long o, int exflag)
diag(a, "initialization of incompatible pointers: %s\n%T and %T",
s->name, t, a->type);
}
- if(a->op == OADDR)
+ if(a->op == OADDR) {
a = a->left;
+ goto gext;
+ }
+ if(a->type->etype == TIND) {
+ diag(a, "initializer is not a constant: %s", s->name);
+ return Z;
+ }
goto gext;
}