Incomplete implementation of #pragma OVERLAY (work in progress)
[fw/sdcc] / src / SDCCsymt.c
index ec3386e24631b84aabe8d8fa5954275a2bb19d53..9d45864c5814029c7fda074b8fe012ac59b3c25e 100644 (file)
@@ -621,6 +621,7 @@ mergeSpec (sym_link * dest, sym_link * src, char *name)
   SPEC_BLEN (dest) |= SPEC_BLEN (src);
   SPEC_BSTR (dest) |= SPEC_BSTR (src);
   SPEC_TYPEDEF (dest) |= SPEC_TYPEDEF (src);
+  SPEC_ENUM (dest) |= SPEC_ENUM (src);
 
   if (IS_STRUCT (dest) && SPEC_STRUCT (dest) == NULL)
     SPEC_STRUCT (dest) = SPEC_STRUCT (src);
@@ -783,7 +784,13 @@ getSize (sym_link * p)
   switch (DCL_TYPE (p))
     {
     case ARRAY:
-      return DCL_ELEM (p) * getSize (p->next);
+      if (DCL_ELEM(p)) {
+       return DCL_ELEM (p) * getSize (p->next);
+      } else {
+       werror (E_INTERNAL_ERROR, __FILE__, __LINE__, 
+               "can not tell the size of an array[]");
+       return 0;
+      }
     case IPOINTER:
     case PPOINTER:
     case POINTER:
@@ -1410,11 +1417,11 @@ computeType (sym_link * type1, sym_link * type2)
   else if (IS_BITVAR (etype2) && !IS_BITVAR (etype1))
     rType = copyLinkChain (type1);
   else
-    /* if one of them is a pointer then that
+    /* if one of them is a pointer or array then that
        prevails */
-  if (IS_PTR (type1))
+  if (IS_PTR (type1) || IS_ARRAY (type1))
     rType = copyLinkChain (type1);
-  else if (IS_PTR (type2))
+  else if (IS_PTR (type2) || IS_ARRAY (type2))
     rType = copyLinkChain (type2);
   else if (getSize (type1) > getSize (type2))
     rType = copyLinkChain (type1);