Message ID | CAOyqgcXhOa=qk7Qvt0go8jGYzX6HC9qUH=ezFCsfMT_SZ33s6Q@mail.gmail.com |
---|---|
State | New |
Headers | show |
Series | Go patch committed: Don't pad epollevent on sparc64 GNU/Linux | expand |
On Wed, Dec 29, 2021 at 03:54:03PM -0800, Ian Lance Taylor via Gcc-patches wrote: > PR go/103847 > * godump.c (go_force_record_alignment): Name the alignment > field "_". > --- a/gcc/godump.c > +++ b/gcc/godump.c > @@ -651,7 +651,7 @@ go_force_record_alignment (struct obstack *ob, const char *type_string, > unsigned int index, const char *error_string) > { > index = go_append_artificial_name (ob, index); > - obstack_grow (ob, "_align ", 7); > + obstack_grow (ob, "_ ", 2); > if (type_string == NULL) > obstack_grow (ob, error_string, strlen (error_string)); > else This change caused +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _ts_nested struct { u struct { s int16; Godump_0_pad \\\\[2\\\\]byte; Godump_1_align \\\\[0\\\\]u?int32; }; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _ts_nested2 struct { u struct { Godump_0_pad \\\\[4\\\\]byte; Godump_1_pad \\\\[2\\\\]byte; s int16; c int8; Godump_2_pad \\\\[1\\\\]byte; Godump_3_pad \\\\[2\\\\]byte; Godump_4_align \\\\[0\\\\]u?int32; }; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_gaps struct { bf1 uint8; c uint8; bf2 uint8; Godump_0_pad \\\\[2\\\\]byte; s uint16; Godump_1_align \\\\[0\\\\]int32; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_pad16_1 struct { Godump_0_pad \\\\[1\\\\]byte; c uint8; Godump_1_align \\\\[0\\\\]int16; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_pad16_2 struct { Godump_0_pad \\\\[2\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int16; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_pad32_1 struct { Godump_0_pad \\\\[1\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int32; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_pad32_2 struct { Godump_0_pad \\\\[4\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int32; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_pad64_1 struct { Godump_0_pad \\\\[1\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_pad64_2 struct { Godump_0_pad \\\\[8\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsn_anon struct { a uint8; s uint16; b uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]int16; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsu_anon struct { c uint8; Godump_0_pad \\\\[7\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tu1 struct { c uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tu3_size struct { ca \\\\[4\\\\+1\\\\]uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tu_nested struct { u struct { s int16; Godump_0_pad \\\\[2\\\\]byte; Godump_1_align \\\\[0\\\\]u?int32; }; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tu_nested2 struct { u struct { Godump_0_pad \\\\[4\\\\]byte; Godump_1_pad \\\\[2\\\\]byte; s int16; c int8; Godump_2_pad \\\\[1\\\\]byte; Godump_3_pad \\\\[2\\\\]byte; Godump_4_align \\\\[0\\\\]u?int32; }; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tu_size struct { ca \\\\[4\\\\+1\\\\]uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _s_nested struct { u struct { s int16; Godump_0_pad \\\\[2\\\\]byte; Godump_1_align \\\\[0\\\\]u?int32; }; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _s_nested2 struct { u struct { Godump_0_pad \\\\[4\\\\]byte; Godump_1_pad \\\\[2\\\\]byte; s int16; c int8; Godump_2_pad \\\\[1\\\\]byte; Godump_3_pad \\\\[2\\\\]byte; Godump_4_align \\\\[0\\\\]u?int32; }; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_gaps struct { bf1 uint8; c uint8; bf2 uint8; Godump_0_pad \\\\[2\\\\]byte; s uint16; Godump_1_align \\\\[0\\\\]int32; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_pad16_1 struct { Godump_0_pad \\\\[1\\\\]byte; c uint8; Godump_1_align \\\\[0\\\\]int16; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_pad16_2 struct { Godump_0_pad \\\\[2\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int16; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_pad32_1 struct { Godump_0_pad \\\\[1\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int32; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_pad32_2 struct { Godump_0_pad \\\\[4\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int32; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_pad64_1 struct { Godump_0_pad \\\\[1\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_pad64_2 struct { Godump_0_pad \\\\[8\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sn_anon struct { a uint8; s uint16; b uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]int16; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _su_anon struct { c uint8; Godump_0_pad \\\\[7\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _u1 struct { c uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _u3_size struct { ca \\\\[4\\\\+1\\\\]uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _u_nested struct { u struct { s int16; Godump_0_pad \\\\[2\\\\]byte; Godump_1_align \\\\[0\\\\]u?int32; }; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _u_nested2 struct { u struct { Godump_0_pad \\\\[4\\\\]byte; Godump_1_pad \\\\[2\\\\]byte; s int16; c int8; Godump_2_pad \\\\[1\\\\]byte; Godump_3_pad \\\\[2\\\\]byte; Godump_4_align \\\\[0\\\\]u?int32; }; }\$ +FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _u_size struct { ca \\\\[4\\\\+1\\\\]uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$ on x86_64-linux. The following patch adjusts the testcase for the above change. Tested on x86_64-linux, ok for trunk? 2021-12-31 Jakub Jelinek <jakub@redhat.com> * gcc.misc-tests/godump-1.c: Adjust for renaming of last field from _align suffix to _ suffix. --- gcc/testsuite/gcc.misc-tests/godump-1.c.jj 2020-12-14 22:46:53.587965119 +0100 +++ gcc/testsuite/gcc.misc-tests/godump-1.c 2021-12-31 09:54:11.835409746 +0100 @@ -501,10 +501,10 @@ struct { struct { uint8_t ca[3]; } s; ui /* { dg-final { scan-file godump-1.out "(?n)^var _sn struct \{ s struct \{ ca \\\[2\\+1\\\]uint8; \}; i uint32; \}$" } } */ typedef struct { struct { uint8_t a; uint16_t s; }; uint8_t b; } tsn_anon; -/* { dg-final { scan-file godump-1.out "(?n)^type _tsn_anon struct \{ a uint8; s uint16; b uint8; Godump_0_pad \\\[.\\\]byte; Godump_1_align \\\[0\\\]int16; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _tsn_anon struct \{ a uint8; s uint16; b uint8; Godump_0_pad \\\[.\\\]byte; Godump_1_ \\\[0\\\]int16; \}$" } } */ struct { struct { uint8_t a; uint16_t s; }; uint8_t b; } sn_anon; -/* { dg-final { scan-file godump-1.out "(?n)^var _sn_anon struct \{ a uint8; s uint16; b uint8; Godump_0_pad \\\[.\\\]byte; Godump_1_align \\\[0\\\]int16; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _sn_anon struct \{ a uint8; s uint16; b uint8; Godump_0_pad \\\[.\\\]byte; Godump_1_ \\\[0\\\]int16; \}$" } } */ /*** structs with bitfields ***/ @@ -575,16 +575,16 @@ struct { uint8_t bf : 8; uint8_t c; } sb /* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad8_3 struct \{ bf uint8; c uint8; \}$" } } */ typedef struct { uint16_t bf : 1; uint8_t c; } tsbf_pad16_1; -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_align \\\[0\\\]int16; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_ \\\[0\\\]int16; \}$" } } */ struct { uint16_t bf : 1; uint8_t c; } sbf_pad16_1; -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_align \\\[0\\\]int16; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_ \\\[0\\\]int16; \}$" } } */ typedef struct { uint16_t bf : 15; uint8_t c; } tsbf_pad16_2; -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_2 struct \{ Godump_0_pad \\\[2\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_align \\\[0\\\]int16; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_2 struct \{ Godump_0_pad \\\[2\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_ \\\[0\\\]int16; \}$" } } */ struct { uint16_t bf : 15; uint8_t c; } sbf_pad16_2; -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_2 struct \{ Godump_0_pad \\\[2\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_align \\\[0\\\]int16; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_2 struct \{ Godump_0_pad \\\[2\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_ \\\[0\\\]int16; \}$" } } */ typedef struct { uint16_t bf : 16; uint8_t c; } tsbf_pad16_3; /* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_3 struct \{ bf uint16; c uint8; Godump_0_pad \\\[.\\\]byte; \}$" } } */ @@ -593,16 +593,16 @@ struct { uint16_t bf : 16; uint8_t c; } /* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_3 struct \{ bf uint16; c uint8; Godump_0_pad \\\[.\\\]byte; \}$" } } */ typedef struct { uint32_t bf : 1; uint8_t c; } tsbf_pad32_1; -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_align \\\[0\\\]int32; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_ \\\[0\\\]int32; \}$" } } */ struct { uint32_t bf : 1; uint8_t c; } sbf_pad32_1; -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_align \\\[0\\\]int32; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_ \\\[0\\\]int32; \}$" } } */ typedef struct { uint32_t bf : 31; uint8_t c; } tsbf_pad32_2; -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_2 struct \{ Godump_0_pad \\\[4\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_align \\\[0\\\]int32; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_2 struct \{ Godump_0_pad \\\[4\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_ \\\[0\\\]int32; \}$" } } */ struct { uint32_t bf : 31; uint8_t c; } sbf_pad32_2; -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_2 struct \{ Godump_0_pad \\\[4\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_align \\\[0\\\]int32; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_2 struct \{ Godump_0_pad \\\[4\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_ \\\[0\\\]int32; \}$" } } */ typedef struct { uint32_t bf : 32; uint8_t c; } tsbf_pad32_3; /* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_3 struct \{ bf uint32; c uint8; Godump_0_pad \\\[.\\\]byte; \}$" } } */ @@ -611,16 +611,16 @@ struct { uint32_t bf : 32; uint8_t c; } /* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_3 struct \{ bf uint32; c uint8; Godump_0_pad \\\[.\\\]byte; \}$" } } */ typedef struct { uint64_t bf : 1; uint8_t c; } tsbf_pad64_1; -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_align \\\[0\\\]int64; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_ \\\[0\\\]int64; \}$" } } */ struct { uint64_t bf : 1; uint8_t c; } sbf_pad64_1; -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_align \\\[0\\\]int64; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_ \\\[0\\\]int64; \}$" } } */ typedef struct { uint64_t bf : 63; uint8_t c; } tsbf_pad64_2; -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_2 struct \{ Godump_0_pad \\\[8\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_align \\\[0\\\]int64; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_2 struct \{ Godump_0_pad \\\[8\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_ \\\[0\\\]int64; \}$" } } */ struct { uint64_t bf : 63; uint8_t c; } sbf_pad64_2; -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_2 struct \{ Godump_0_pad \\\[8\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_align \\\[0\\\]int64; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_2 struct \{ Godump_0_pad \\\[8\\\]byte; c uint8; Godump_1_pad \\\[.\\\]byte; Godump_2_ \\\[0\\\]int64; \}$" } } */ typedef struct { uint64_t bf : 64; uint8_t c; } tsbf_pad64_3; /* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_3 struct \{ bf uint\[0-9\]*; c uint8; Godump_0_pad \\\[.\\\]byte; \}$" } } */ @@ -680,7 +680,7 @@ struct uint32_t bf3 : 12; uint16_t s; } sbf_gaps; -/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_gaps struct \{ bf1 uint8; c uint8; bf2 uint8; Godump_0_pad \\\[2\\\]byte; s uint16; Godump_1_align \\\[0\\\]int32; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_gaps struct \{ bf1 uint8; c uint8; bf2 uint8; Godump_0_pad \\\[2\\\]byte; s uint16; Godump_1_ \\\[0\\\]int32; \}$" } } */ typedef struct { @@ -690,7 +690,7 @@ typedef struct uint32_t bf3 : 12; uint16_t s; } tsbf_gaps; -/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_gaps struct \{ bf1 uint8; c uint8; bf2 uint8; Godump_0_pad \\\[2\\\]byte; s uint16; Godump_1_align \\\[0\\\]int32; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_gaps struct \{ bf1 uint8; c uint8; bf2 uint8; Godump_0_pad \\\[2\\\]byte; s uint16; Godump_1_ \\\[0\\\]int32; \}$" } } */ typedef struct { @@ -708,7 +708,7 @@ typedef struct }; } u; } ts_nested; -/* { dg-final { scan-file godump-1.out "(?n)^type _ts_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; Godump_1_align \\\[0\\\]u?int32; \}; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _ts_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; Godump_1_ \\\[0\\\]u?int32; \}; \}$" } } */ struct { @@ -726,7 +726,7 @@ struct }; } u; } s_nested; -/* { dg-final { scan-file godump-1.out "(?n)^var _s_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; Godump_1_align \\\[0\\\]u?int32; \}; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _s_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; Godump_1_ \\\[0\\\]u?int32; \}; \}$" } } */ typedef struct { @@ -744,7 +744,7 @@ typedef struct }; } u; } ts_nested2; -/* { dg-final { scan-file godump-1.out "(?n)^type _ts_nested2 struct \{ u struct \{ Godump_0_pad \\\[4\\\]byte; Godump_1_pad \\\[2\\\]byte; s int16; c int8; Godump_2_pad \\\[1\\\]byte; Godump_3_pad \\\[2\\\]byte; Godump_4_align \\\[0\\\]u?int32; \}; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _ts_nested2 struct \{ u struct \{ Godump_0_pad \\\[4\\\]byte; Godump_1_pad \\\[2\\\]byte; s int16; c int8; Godump_2_pad \\\[1\\\]byte; Godump_3_pad \\\[2\\\]byte; Godump_4_ \\\[0\\\]u?int32; \}; \}$" } } */ struct { @@ -762,7 +762,7 @@ struct }; } u; } s_nested2; -/* { dg-final { scan-file godump-1.out "(?n)^var _s_nested2 struct \{ u struct \{ Godump_0_pad \\\[4\\\]byte; Godump_1_pad \\\[2\\\]byte; s int16; c int8; Godump_2_pad \\\[1\\\]byte; Godump_3_pad \\\[2\\\]byte; Godump_4_align \\\[0\\\]u?int32; \}; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _s_nested2 struct \{ u struct \{ Godump_0_pad \\\[4\\\]byte; Godump_1_pad \\\[2\\\]byte; s int16; c int8; Godump_2_pad \\\[1\\\]byte; Godump_3_pad \\\[2\\\]byte; Godump_4_ \\\[0\\\]u?int32; \}; \}$" } } */ /*** unions ***/ @@ -780,10 +780,10 @@ union u_t_idem_v2 { }; /* { dg-final { scan-file godump-1.out "(?n)^type _u_t_idem_v2 struct \{ \}$" } } */ typedef union { uint8_t c; uint64_t l; } tu1; -/* { dg-final { scan-file godump-1.out "(?n)^type _tu1 struct \{ c uint8; Godump_0_pad \\\[.\\\]byte; Godump_1_align \\\[0\\\]u?int64; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _tu1 struct \{ c uint8; Godump_0_pad \\\[.\\\]byte; Godump_1_ \\\[0\\\]u?int64; \}$" } } */ union { uint8_t c; uint64_t l; } u1; -/* { dg-final { scan-file godump-1.out "(?n)^var _u1 struct \{ c uint8; Godump_0_pad \\\[.\\\]byte; Godump_1_align \\\[0\\\]u?int64; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _u1 struct \{ c uint8; Godump_0_pad \\\[.\\\]byte; Godump_1_ \\\[0\\\]u?int64; \}$" } } */ typedef union { uint64_t l; uint8_t c; } tu2; /* { dg-final { scan-file godump-1.out "(?n)^type _tu2 struct \{ l uint64; \}$" } } */ @@ -798,16 +798,16 @@ union { uint64_t l[3]; uint8_t c; } u3; /* { dg-final { scan-file godump-1.out "(?n)^var _u3 struct \{ l \\\[2\\+1\\\]uint64; \}$" } } */ typedef struct { union { uint8_t c; uint64_t l; }; } tsu_anon; -/* { dg-final { scan-file godump-1.out "(?n)^type _tsu_anon struct \{ c uint8; Godump_0_pad \\\[7\\\]byte; Godump_1_align \\\[0\\\]u?int64; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _tsu_anon struct \{ c uint8; Godump_0_pad \\\[7\\\]byte; Godump_1_ \\\[0\\\]u?int64; \}$" } } */ struct { union { uint8_t c; uint64_t l; }; } su_anon; -/* { dg-final { scan-file godump-1.out "(?n)^var _su_anon struct \{ c uint8; Godump_0_pad \\\[7\\\]byte; Godump_1_align \\\[0\\\]u?int64; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _su_anon struct \{ c uint8; Godump_0_pad \\\[7\\\]byte; Godump_1_ \\\[0\\\]u?int64; \}$" } } */ typedef union { uint64_t bf : 1; uint8_t ca[5]; } tu_size; -/* { dg-final { scan-file godump-1.out "(?n)^type _tu_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_pad \\\[.\\\]byte; Godump_1_align \\\[0\\\]u?int64; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _tu_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_pad \\\[.\\\]byte; Godump_1_ \\\[0\\\]u?int64; \}$" } } */ union { uint64_t bf : 1; uint8_t ca[5]; } u_size; -/* { dg-final { scan-file godump-1.out "(?n)^var _u_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_pad \\\[.\\\]byte; Godump_1_align \\\[0\\\]u?int64; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _u_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_pad \\\[.\\\]byte; Godump_1_ \\\[0\\\]u?int64; \}$" } } */ typedef union { uint64_t : 1; uint8_t ca[5]; } tu2_size; /* { dg-final { scan-file godump-1.out "(?n)^type _tu2_size struct \{ ca \\\[4\\+1\\\]uint8; \}$" } } */ @@ -818,10 +818,10 @@ union { uint64_t : 1; uint8_t ca[5]; } u typedef union u_undef_t u_undef_t2; typedef union { uint64_t b : 1; uint8_t ca[5]; } tu3_size; -/* { dg-final { scan-file godump-1.out "(?n)^type _tu3_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_pad \\\[.\\\]byte; Godump_1_align \\\[0\\\]u?int64; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _tu3_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_pad \\\[.\\\]byte; Godump_1_ \\\[0\\\]u?int64; \}$" } } */ union { uint64_t b : 1; uint8_t ca[5]; } u3_size; -/* { dg-final { scan-file godump-1.out "(?n)^var _u3_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_pad \\\[.\\\]byte; Godump_1_align \\\[0\\\]u?int64; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _u3_size struct \{ ca \\\[4\\+1\\\]uint8; Godump_0_pad \\\[.\\\]byte; Godump_1_ \\\[0\\\]u?int64; \}$" } } */ typedef union { @@ -839,7 +839,7 @@ typedef union }; } u; } tu_nested; -/* { dg-final { scan-file godump-1.out "(?n)^type _tu_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; Godump_1_align \\\[0\\\]u?int32; \}; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _tu_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; Godump_1_ \\\[0\\\]u?int32; \}; \}$" } } */ union { @@ -857,7 +857,7 @@ union }; } u; } u_nested; -/* { dg-final { scan-file godump-1.out "(?n)^var _u_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; Godump_1_align \\\[0\\\]u?int32; \}; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _u_nested struct \{ u struct \{ s int16; Godump_0_pad \\\[2\\\]byte; Godump_1_ \\\[0\\\]u?int32; \}; \}$" } } */ typedef union { @@ -875,7 +875,7 @@ typedef union }; } u; } tu_nested2; -/* { dg-final { scan-file godump-1.out "(?n)^type _tu_nested2 struct \{ u struct \{ Godump_0_pad \\\[4\\\]byte; Godump_1_pad \\\[2\\\]byte; s int16; c int8; Godump_2_pad \\\[1\\\]byte; Godump_3_pad \\\[2\\\]byte; Godump_4_align \\\[0\\\]u?int32; \}; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^type _tu_nested2 struct \{ u struct \{ Godump_0_pad \\\[4\\\]byte; Godump_1_pad \\\[2\\\]byte; s int16; c int8; Godump_2_pad \\\[1\\\]byte; Godump_3_pad \\\[2\\\]byte; Godump_4_ \\\[0\\\]u?int32; \}; \}$" } } */ union { @@ -893,7 +893,7 @@ union }; } u; } u_nested2; -/* { dg-final { scan-file godump-1.out "(?n)^var _u_nested2 struct \{ u struct \{ Godump_0_pad \\\[4\\\]byte; Godump_1_pad \\\[2\\\]byte; s int16; c int8; Godump_2_pad \\\[1\\\]byte; Godump_3_pad \\\[2\\\]byte; Godump_4_align \\\[0\\\]u?int32; \}; \}$" } } */ +/* { dg-final { scan-file godump-1.out "(?n)^var _u_nested2 struct \{ u struct \{ Godump_0_pad \\\[4\\\]byte; Godump_1_pad \\\[2\\\]byte; s int16; c int8; Godump_2_pad \\\[1\\\]byte; Godump_3_pad \\\[2\\\]byte; Godump_4_ \\\[0\\\]u?int32; \}; \}$" } } */ /*** functions ***/ Jakub
On Fri, Dec 31, 2021 at 1:32 AM Jakub Jelinek <jakub@redhat.com> wrote: > > The following patch adjusts the testcase for the above change. > Tested on x86_64-linux, ok for trunk? > > 2021-12-31 Jakub Jelinek <jakub@redhat.com> > > * gcc.misc-tests/godump-1.c: Adjust for renaming of last > field from _align suffix to _ suffix. > This is OK. Thanks, and sorry for the trouble. Ian
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 05e47ec3fa9..2d04f4b01c0 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -3e9f4ee16683883ccfb8661d99318c74bb7a4bef +d3be41f0a1fca20e241e1db62b4b0f5262caac55 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index 0f66661937c..57c02a97ef0 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -6454,9 +6454,18 @@ get_backend_struct_fields(Gogo* gogo, Struct_type* type, bool use_placeholder, ? p->type()->get_backend_placeholder(gogo) : p->type()->get_backend(gogo)); (*bfields)[i].location = p->location(); - lastsize = gogo->backend()->type_size((*bfields)[i].btype); - if (lastsize != 0) - saw_nonzero = true; + int64_t size = gogo->backend()->type_size((*bfields)[i].btype); + if (size != 0) + saw_nonzero = true; + + if (size > 0 || !Gogo::is_sink_name(p->field_name())) + lastsize = size; + else + { + // There is an unreferenceable field of zero size. This + // doesn't affect whether we may need zero padding, so leave + // lastsize unchanged. + } } go_assert(i == fields->size()); if (saw_nonzero && lastsize == 0 && !type->is_results_struct()) diff --git a/gcc/godump.c b/gcc/godump.c index a50aef1f5fa..f016989c93f 100644 --- a/gcc/godump.c +++ b/gcc/godump.c @@ -651,7 +651,7 @@ go_force_record_alignment (struct obstack *ob, const char *type_string, unsigned int index, const char *error_string) { index = go_append_artificial_name (ob, index); - obstack_grow (ob, "_align ", 7); + obstack_grow (ob, "_ ", 2); if (type_string == NULL) obstack_grow (ob, error_string, strlen (error_string)); else diff --git a/libgo/mkrsysinfo.sh b/libgo/mkrsysinfo.sh index 18643370645..be150905f91 100755 --- a/libgo/mkrsysinfo.sh +++ b/libgo/mkrsysinfo.sh @@ -98,7 +98,7 @@ if grep '^const _epoll_data_offset ' ${OUT} >/dev/null 2>&1; then echo 'type epollevent struct { events uint32; data [8]byte }' >> ${OUT} elif test "$val" = "8"; then if test "$GOARCH" = "sparc64" -a "$GOOS" = "linux"; then - echo 'type epollevent struct { events uint32; pad [4]byte; data [8]byte; _align [0]int64 }' >> ${OUT} + echo 'type epollevent struct { events uint32; pad [4]byte; data [8]byte; _ [0]int64 }' >> ${OUT} else echo 'type epollevent struct { events uint32; pad [4]byte; data [8]byte }' >> ${OUT} fi