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

 sizeofType md _ (DirectType (TyEnum _) _ _) = return $ iSize md TyInt
 sizeofType md _ (DirectType (TyBuiltin b) _ _) = return $ builtinSize md b
 sizeofType md _ (PtrType _ _ _)  = return $ ptrSize md
@@ -66,6 +66,7 @@ alignofType md _ (DirectType TyVoid _ _) = return $ voidAlign md
 alignofType md _ (DirectType (TyIntegral it) _ _) = return $ iAlign md it
 alignofType md _ (DirectType (TyFloating ft) _ _) = return $ fAlign md ft
 alignofType md _ (DirectType (TyComplex ft) _ _) = return $ fAlign md ft

 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 +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
 
