]> git.gag.com Git - fw/sdcc/commitdiff
fixed bug #436360 part 1 and 3
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 16 Oct 2001 15:05:58 +0000 (15:05 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 16 Oct 2001 15:05:58 +0000 (15:05 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1409 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCC.y
src/SDCCast.c
src/SDCCicode.c
src/SDCCsymt.c

index ce8a014b85748c7b6ed1e8d68fcbcddcaf50877d..776775bafa53ed55e6b70e057144c25c589d178b 100644 (file)
@@ -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
index 235ee0376df623e51d8ccc51e1c871825af84b2f..1600a5d259bbc516622befabb5265d7e7dd17853 100644 (file)
@@ -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);
index 0caa5b2f9643a03d7bfa94523173ded256709600..ecbe659b3b1d703ad5305ef7e390259a1cfb56a0 100644 (file)
@@ -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;
+    }
   }
 
 
index de4b9d4b82184df0772590ee07123764807d9e18..77b03a7539247133beb29bf3eab3ec6309e17c70 100644 (file)
@@ -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;