  alignofType md _ (DirectType (TyEnum _) _ _) = return $ iAlign md TyInt
  alignofType md _ (DirectType (TyBuiltin b) _ _) = return $ builtinAlign md b
  alignofType md _ (PtrType _ _ _)  = return $ ptrAlign md
-@@ -75,8 +76,13 @@ alignofType md n (TypeDefType (TypeDefRef _ t _) _ _) = alignofType md n t
+@@ -75,8 +77,13 @@ alignofType md n (TypeDefType (TypeDefRef _ t _) _ _) = alignofType md n t
  alignofType _ n t = astError (nodeInfo n) $
                   "can't find alignment of type: " ++ (render . pretty) t
  

   do dt <- getDefTable
      case lookupTag (sueRef ctr) dt of
        Just (Left _)   -> astError (nodeInfo ctr)
@@ -84,13 +90,33 @@ compSize md ctr =
        Just (Right (CompDef (CompType _ tag ms _ ni))) ->
          do let ts = map declType ms
             sizes <- mapM (sizeofType md ni) ts

+                  StructTag ->
+                    let sizeAndNextAlignment =
+                          zip sizes (tail aligns ++ [alignment])
+                        offsets = foldl'
+                          (\offset (memberSize, nextAlign)
+                           -> roundToAlignment nextAlign (offset + memberSize))
+                          0
+                          sizeAndNextAlignment
+                    in offsets
+            return (size, alignment)
+       Just (Right (EnumDef _)) -> return $ (iSize md TyInt, iAlign md TyInt)
        Nothing         -> astError (nodeInfo ctr) "unknown composite"
