From 1a97b2cbe101d3c3032c88a81c08667b8da70988 Mon Sep 17 00:00:00 2001 From: Arkshine Date: Tue, 11 Nov 2014 12:27:34 +0100 Subject: [PATCH] Improve more sizeof return on array without specifiying the dimension --- compiler/libpc300/sc1.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/compiler/libpc300/sc1.c b/compiler/libpc300/sc1.c index 7d5967f0..45f9d344 100755 --- a/compiler/libpc300/sc1.c +++ b/compiler/libpc300/sc1.c @@ -2264,18 +2264,18 @@ static void initials(int ident,int tag,cell *size,int dim[],int numdim, * the same value; if so, we can store this */ constvalue *ld=lastdim.next; - int d,match; - for (d=0; dname,NULL,16)==d); - if (d==0) - match=ld->value; - else if (match!=ld->value) - break; + int match; + assert(ld!=NULL); + assert(strtol(ld->name,NULL,16)==0); + match=ld->value; + while (ld->next) { ld=ld->next; - } /* for */ - if (d==dim[numdim-2]) - dim[numdim-1]=match; + if (match!=ld->value) { + match=0; + break; + } + } + dim[numdim-1]=match; } /* if */ /* after all arrays have been initalized, we know the (major) dimensions * of the array and we can properly adjust the indirection vectors