summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2007-09-22 14:36:19 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2007-09-22 14:36:19 +0000
commit2f4c0f7fcd17f93623ae8c6f7faebd9d1dc00dad (patch)
treee13d579f3a93e06f7852a4439287938e8c934109 /usr.bin
parentd822794253f03bc4aef2799472dda80873fa2777 (diff)
Fix from ragge:
Fix lost initializers when an array comes after something else in a struct. Reported in OpenBSD PR#5586.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/pcc/cc/ccom/init.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/pcc/cc/ccom/init.c b/usr.bin/pcc/cc/ccom/init.c
index bca2c4227fe..06f455772b0 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.2 2007/09/15 22:04:38 ray Exp $ */
+/* $OpenBSD: init.c,v 1.3 2007/09/22 14:36:18 otto Exp $ */
/*
* Copyright (c) 2004, 2007 Anders Magnusson (ragge@ludd.ltu.se).
@@ -386,8 +386,12 @@ findoff(void)
t = DECREF(t);
o = ISPTR(t) ? SZPOINT(t) : is->in_sym->ssue->suesize;
off += o * acalc(is, 1);
- while (is->in_prev && ISARY(is->in_prev->in_t))
+ while (is->in_prev && ISARY(is->in_prev->in_t)) {
+ if (is->in_prev->in_prev &&
+ is->in_prev->in_prev->in_t == STRTY)
+ off += is->in_sym->soffset;
is = is->in_prev;
+ }
}
}
if (idebug>1) {