diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-09-29 15:19:14 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-09-29 15:19:14 +0000 |
commit | a99402a30cb18c71b3ee1e4447b53e95f24a3948 (patch) | |
tree | fec5996110282b1a9790732526c4e487b01ea454 | |
parent | 480f53ea5cd00520a87c15a17d9a407aae570dce (diff) |
check if initializer element is a constant in MI code. ok ragge@
-rw-r--r-- | usr.bin/pcc/cc/ccom/init.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/pcc/cc/ccom/init.c b/usr.bin/pcc/cc/ccom/init.c index f8dc543b14c..3813cf8369c 100644 --- a/usr.bin/pcc/cc/ccom/init.c +++ b/usr.bin/pcc/cc/ccom/init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init.c,v 1.7 2007/09/29 13:57:14 otto Exp $ */ +/* $OpenBSD: init.c,v 1.8 2007/09/29 15:19:13 otto Exp $ */ /* * Copyright (c) 2004, 2007 Anders Magnusson (ragge@ludd.ltu.se). @@ -944,7 +944,10 @@ simpleinit(struct symtab *sp, NODE *p) spname = sp; p = optim(buildtree(ASSIGN, buildtree(NAME, NIL, NIL), p)); setscl(sp); - ninval(0, p->n_right->n_sue->suesize, p->n_right); + if (p->n_right->n_op != ICON && p->n_right->n_op != FCON) + uerror("initializer element is not a constant"); + else + ninval(0, p->n_right->n_sue->suesize, p->n_right); tfree(p); break; |