more bitfield related fixes
authorsandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 14 Nov 2000 00:56:09 +0000 (00:56 +0000)
committersandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 14 Nov 2000 00:56:09 +0000 (00:56 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@499 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCsymt.c

index e2780d51550126e8f7a5453aedd68f439f6763b2..f3980ed4a1849cb567f4d1b1e8ce291010b52816 100644 (file)
@@ -786,7 +786,9 @@ int funcInChain (link *lnk)
 link *structElemType (link *stype, value *id ,value **argsp)
 {
     symbol *fields = (SPEC_STRUCT(stype) ? SPEC_STRUCT(stype)->fields : NULL);
-    
+    link *type, *etype;
+    link *petype = getSpec(stype);
+
     if ( ! fields || ! id)
        return NULL ;
        
@@ -796,7 +798,10 @@ link *structElemType (link *stype, value *id ,value **argsp)
            if (argsp) {
                *argsp = fields->args;
            }
-           return copyLinkChain (fields->type) ;
+           type = copyLinkChain (fields->type) ;
+           etype=getSpec(type);
+           SPEC_SCLS(etype) = SPEC_SCLS(petype);
+           return type;
        }
        fields = fields->next ;
     }
@@ -833,6 +838,7 @@ int   compStructSize (int su, structdef  *sdef )
     /* for the identifiers  */
     loop = sdef->fields ;
     while ( loop ) {
+       int pbvar =0;
 
        /* create the internal name for this variable */
        sprintf (loop->rname,"_%s",loop->name);
@@ -875,9 +881,13 @@ int   compStructSize (int su, structdef  *sdef )
        if (funcInChain(loop->type)) {
            processFuncArgs (loop, 1);
        }
-
+       pbvar = loop->bitVar;
        loop = loop->next ;
-
+       /* if this is a bitvar & the previous one was not */
+       if (loop && loop->bitVar && pbvar == 0) {
+               bitOffset = 0;
+               sum++;
+       }
        /* if this is not a bitfield but the */
        /* previous one was and did not take */
        /* the whole byte then pad the rest  */