浏览代码

FFI: Correctly propagate alignment when interning nested types.

Mike Pall 13 年之前
父节点
当前提交
76ab3709da
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/lj_cparse.c

+ 3 - 1
src/lj_cparse.c

@@ -918,7 +918,9 @@ static CTypeID cp_decl_intern(CPState *cp, CPDecl *decl)
 	    size = (CTSize)xsz;
 	  }
 	}
-	info |= (cinfo & (CTF_QUAL|CTF_ALIGN));  /* Inherit qual and align. */
+	if ((cinfo & CTF_ALIGN) > (info & CTF_ALIGN))  /* Find max. align. */
+	  info = (info & ~CTF_ALIGN) | (cinfo & CTF_ALIGN);
+	info |= (cinfo & CTF_QUAL);  /* Inherit qual. */
       } else {
 	lua_assert(ctype_isvoid(info));
       }