X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCval.c;h=1a802a15b500dad1eea2735f1fbe10589cfe9515;hb=5b5794db23486b640662c6eefbf83c8dee2c5801;hp=70b166647529b791597009e4f7f1c606e8fb47d8;hpb=03ce687ddab2fa115068ef4e8de01f51d8587f2f;p=fw%2Fsdcc diff --git a/src/SDCCval.c b/src/SDCCval.c index 70b16664..1a802a15 100644 --- a/src/SDCCval.c +++ b/src/SDCCval.c @@ -273,30 +273,28 @@ list2expr (initList * ilist) void resolveIvalSym (initList * ilist, sym_link * type) { - RESULT_TYPE resultType; + int is_ptr = IS_PTR (type); + RESULT_TYPE resultType = getResultTypeFromType (getSpec (type)); - if (!ilist) - return; - - if (ilist->type == INIT_NODE) + while (ilist) { - if (IS_PTR (type)) - resultType = RESULT_TYPE_INT; - else - resultType = getResultTypeFromType (getSpec (type)); - ilist->init.node = decorateType (resolveSymbols (ilist->init.node), - resultType); - } - - if (ilist->type == INIT_DEEP) - resolveIvalSym (ilist->init.deep, type); + if (ilist->type == INIT_NODE) + { + ilist->init.node = decorateType (resolveSymbols (ilist->init.node), + is_ptr ? RESULT_TYPE_INT : resultType); + } + else if (ilist->type == INIT_DEEP) + { + resolveIvalSym (ilist->init.deep, type); + } - resolveIvalSym (ilist->next, type); + ilist = ilist->next; + } } -/*-----------------------------------------------------------------*/ -/* symbolVal - creates a value for a symbol */ -/*-----------------------------------------------------------------*/ +/*------------------------------------------------------------------*/ +/* symbolVal - creates a value for a symbol */ +/*------------------------------------------------------------------*/ value * symbolVal (symbol * sym) {