On Tue, Dec 8, 2020 at 2:57 PM Nikhil Benesch wrote: > > This patch corrects -fdump-go-spec's handling of incomplete types. > To my knowledge the issue fixed here has not been previously > reported. It was exposed by an in-progress port of gccgo to FreeBSD. > > Given the following C code > > struct s_fwd v_fwd; > struct s_fwd { }; > > -fdump-go-spec currently produces the following Go code > > var v_fwd struct {}; > type s_fwd s_fwd; > > whereas the correct Go code is: > > var v_fwd s_fwd; > type s_fwd struct {}; > > (Go is considerably more permissive than C with out-of-order > declarations, so anywhere an out-of-order declaration is valid in > C it is valid in Go.) > > gcc/: > * godump.c (go_format_type): Don't consider whether a type has > been seen when determining whether to output a type by name. > Consider only the use_type_name parameter. > (go_output_typedef): When outputting a typedef, format the > declaration's original type, which contains the name of the > underlying type rather than the name of the typedef. > gcc/testsuite: > * gcc.misc-tests/godump-1.c: Add test case. Thanks. I changed function types to use type names, and committed like so. Ian