From 6e87cfa299c98d36e79e8b8718a4126899a3ba2f Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 17 Jan 2025 10:39:49 +0100 Subject: pkg/compiler: fix struct layout bug Currently we have a bug in struct layout that affects some corner cases that involve recursive structs. The result of this bug is that we use wrong alignment 1 (not yet calculated) for some structs when calculating layout of other structs. The root cause of this bug is that we calculate struct alignment too early in typeStruct.Gen when structs are not yet laid out. For this reason we moved struct size calculation to the later phase (after compiler.layoutStruct). Move alignment calculation from typeStruct.Gen to compiler.layoutStruct to fix this. --- sys/test/test/align3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sys/test') diff --git a/sys/test/test/align3 b/sys/test/test/align3 index 7a6331c99..00ba25576 100644 --- a/sys/test/test/align3 +++ b/sys/test/test/align3 @@ -1,4 +1,4 @@ # 32 has 4-byte alignment for int64 and everything goes havoc. # requires: -arch=32 -bigendian -syz_compare(&AUTO="00000000000000000199999999999999990300000000000000009999999999999999000000000000", AUTO, &AUTO=@align3={{0x0}, 0x1, {{0x2}}, 0x3, [{{0x4}}, {{0x5}}]}, AUTO) +syz_compare(&AUTO="000000000000000001000000000000009999999999999999030000000000000000000000000000009999999999999999", AUTO, &AUTO=@align3={{0x0}, 0x1, {{0x2}}, 0x3, [{{0x4}}, {{0x5}}]}, AUTO) -- cgit mrf-deployment