From: johanknol Date: Tue, 16 Oct 2001 15:05:58 +0000 (+0000) Subject: fixed bug #436360 part 1 and 3 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=58151142d861d5ddf8d0de65544016fe6fa7e3c0;p=fw%2Fsdcc fixed bug #436360 part 1 and 3 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1409 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/SDCC.y b/src/SDCC.y index ce8a014b..776775ba 100644 --- a/src/SDCC.y +++ b/src/SDCC.y @@ -1001,7 +1001,20 @@ unqualified_pointer type_specifier_list : type_specifier - | type_specifier_list type_specifier { $$ = mergeSpec ($1,$2, "type_specifier_list"); } + //| type_specifier_list type_specifier { $$ = mergeSpec ($1,$2, "type_specifier_list"); } + | type_specifier_list type_specifier { + /* if the decl $2 is not a specifier */ + /* find the spec and replace it */ + if ( !IS_SPEC($2)) { + sym_link *lnk = $2 ; + while (lnk && !IS_SPEC(lnk->next)) + lnk = lnk->next; + lnk->next = mergeSpec($1,lnk->next, "type_specifier_list"); + $$ = $2 ; + } + else + $$ = mergeSpec($1,$2, "type_specifier_list"); + } ; parameter_identifier_list diff --git a/src/SDCCast.c b/src/SDCCast.c index 235ee037..1600a5d2 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -605,8 +605,8 @@ int processParms (ast * func, value * defParm, ast * actParm, - int *parmNumber, - bool rightmost) + int *parmNumber, // unused, although updated + bool rightmost) // double checked? { sym_link *fetype = func->etype; @@ -616,7 +616,7 @@ processParms (ast * func, if (defParm) { if (getenv("DEBUG_SANITY")) { - fprintf (stderr, "addSym: %s ", defParm->name); + fprintf (stderr, "processParms: %s ", defParm->name); } /* make sure the type is complete and sane */ checkTypeSanity(defParm->etype, defParm->name); @@ -741,7 +741,6 @@ processParms (ast * func, } } - /* the parameter type must be at least castable */ if (compareType (defParm->type, actParm->ftype) == 0) { werror (E_INCOMPAT_TYPES); diff --git a/src/SDCCicode.c b/src/SDCCicode.c index 0caa5b2f..ecbe659b 100644 --- a/src/SDCCicode.c +++ b/src/SDCCicode.c @@ -136,9 +136,17 @@ void checkConstantRange(sym_link *ltype, value *val, char *msg, int pedantic) { max = pow ((double)2.0, (double)bitsForType(ltype)); if (SPEC_LONG(val->type)) { - v=SPEC_CVAL(val->type).v_long; + if (SPEC_USIGN(val->type)) { + v=SPEC_CVAL(val->type).v_ulong; + } else { + v=SPEC_CVAL(val->type).v_long; + } } else { - v=SPEC_CVAL(val->type).v_int; + if (SPEC_USIGN(val->type)) { + v=SPEC_CVAL(val->type).v_uint; + } else { + v=SPEC_CVAL(val->type).v_int; + } } diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index de4b9d4b..77b03a75 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -1546,6 +1546,8 @@ inCalleeSaveList (char *s) void aggregateArgToPointer (value * val) { + int wasArray=IS_ARRAY(val->type); + if (IS_AGGREGATE (val->type)) { /* if this is a structure */ @@ -1598,6 +1600,12 @@ aggregateArgToPointer (value * val) default: DCL_TYPE (val->type) = GPOINTER; } + + if (wasArray) { + /* there is NO way to specify the storage of the pointer + associated with an array, so we make it the default */ + SPEC_SCLS(val->etype) = S_FIXED; + } /* is there is a symbol associated then */ /* change the type of the symbol as well */ @@ -1698,7 +1706,7 @@ checkFunction (symbol * sym) werror (E_PREV_DEF_CONFLICT, csym->name, "_naked"); } - /* compare expected agrs with actual args */ + /* compare expected args with actual args */ exargs = csym->args; acargs = sym->args;