From c8a2ee66f80f73936e93c8505984d5b4ed63b84a Mon Sep 17 00:00:00 2001 From: bernhardheld Date: Wed, 28 Aug 2002 20:37:09 +0000 Subject: [PATCH] src/SDCCglue.c (printIvalArray): iterative calculation of array length git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2088 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 3 +++ src/SDCCglue.c | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e0727cdd..b1309016 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2002-08-28 Bernhard Held + * src/SDCCglue.c (printIvalArray): iterative calculation of array length + 2002-08-28 Jesus Calvino-Fraga and Borut Razem * sdcc/sdcc.dsw: added sdcpp, sdcppa, yacc, conf projects diff --git a/src/SDCCglue.c b/src/SDCCglue.c index 590320ca..76582d4f 100644 --- a/src/SDCCglue.c +++ b/src/SDCCglue.c @@ -734,12 +734,13 @@ printIvalChar (sym_link * type, initList * ilist, FILE * oFile, char *s) /*-----------------------------------------------------------------*/ /* printIvalArray - generates code for array initialization */ /*-----------------------------------------------------------------*/ -void +void printIvalArray (symbol * sym, sym_link * type, initList * ilist, FILE * oFile) { initList *iloop; int lcnt = 0, size = 0; + sym_link *last_type; /* take care of the special case */ /* array of characters can be init */ @@ -762,7 +763,9 @@ printIvalArray (symbol * sym, sym_link * type, initList * ilist, } iloop = ilist->init.deep; - lcnt = DCL_ELEM (type); + lcnt = 1; + for (last_type = type; last_type; last_type = last_type->next) + lcnt *= DCL_ELEM (last_type); for (;;) { -- 2.47.2