From: Nikhil Benesch <nikhil.benesch@gmail.com>
To: Rainer Orth <ro@cebitec.uni-bielefeld.de>
Cc: Ian Lance Taylor via Gcc-patches <gcc-patches@gcc.gnu.org>,
Ian Lance Taylor <iant@google.com>,
gcc-patches <gcc-patches@gnu.org>
Subject: Re: [PATCH] Correct -fdump-go-spec's handling of incomplete types
Date: Thu, 10 Dec 2020 14:31:11 -0500 [thread overview]
Message-ID: <CAPWqQZRp8BKBBz3bfzKH543bY7g28aHp+idObjHk7Ot3Fr1RwQ@mail.gmail.com> (raw)
In-Reply-To: <yddlfe531wq.fsf@CeBiTec.Uni-Bielefeld.DE>
Sorry about this, Rainer. I think I see the issue, though it's hard to
be certain without access to a Solaris machine. Assuming the icmp6.h
header hasn't changed since the last time Solaris code was open source
[0], I think the issue is likely to be typedefs that define a named
struct and an alias for that struct in one shot. I'll start pulling on
that thread.
[0]: https://github.com/kofemann/opensolaris/blob/80192cd83/usr/src/uts/common/netinet/icmp6.h#L71-L74
On Thu, Dec 10, 2020 at 2:18 PM Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>
> Hi Ian,
>
> > On Tue, Dec 8, 2020 at 2:57 PM Nikhil Benesch <nikhil.benesch@gmail.com> 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.
>
> This patch badly broke Solaris bootstrap:
>
> runtime_sysinfo.go:623:6: error: invalid recursive type
> 623 | type ___FILE ___FILE
> | ^
> runtime_sysinfo.go:7045:6: error: redefinition of ‘_mld_hdr_t’
> 7045 | type _mld_hdr_t _mld_hdr
> | ^
> runtime_sysinfo.go:1510:6: note: previous definition of ‘_mld_hdr_t’ was here
> 1510 | type _mld_hdr_t _mld_hdr
> | ^
> runtime_sysinfo.go:7070:6: error: redefinition of ‘_upad128_t’
> 7070 | type _upad128_t struct { _l [4]uint32; }
> | ^
> runtime_sysinfo.go:7029:6: note: previous definition of ‘_upad128_t’ was here
> 7029 | type _upad128_t struct {}
> | ^
> runtime_sysinfo.go:7071:6: error: redefinition of ‘_zone_net_addr_t’
> 7071 | type _zone_net_addr_t _zone_net_addr
> | ^
> runtime_sysinfo.go:1079:6: note: previous definition of ‘_zone_net_addr_t’ was here
> 1079 | type _zone_net_addr_t _zone_net_addr
> | ^
> runtime_sysinfo.go:7072:6: error: redefinition of ‘_flow_arp_desc_t’
> 7072 | type _flow_arp_desc_t _flow_arp_desc_s
> | ^
> runtime_sysinfo.go:1127:6: note: previous definition of ‘_flow_arp_desc_t’ was here
> 1127 | type _flow_arp_desc_t _flow_arp_desc_s
> | ^
> runtime_sysinfo.go:7073:6: error: redefinition of ‘_flow_l3_desc_t’
> 7073 | type _flow_l3_desc_t _flow_l3_desc_s
> | ^
> runtime_sysinfo.go:1130:6: note: previous definition of ‘_flow_l3_desc_t’ was here
> 1130 | type _flow_l3_desc_t _flow_l3_desc_s
> | ^
> runtime_sysinfo.go:7074:6: error: redefinition of ‘_mac_ipaddr_t’
> 7074 | type _mac_ipaddr_t _mac_ipaddr_s
> | ^
> runtime_sysinfo.go:1150:6: note: previous definition of ‘_mac_ipaddr_t’ was here
> 1150 | type _mac_ipaddr_t _mac_ipaddr_s
> | ^
> runtime_sysinfo.go:7075:6: error: redefinition of ‘_mactun_info_t’
> 7075 | type _mactun_info_t _mactun_info_s
> | ^
> runtime_sysinfo.go:1213:6: note: previous definition of ‘_mactun_info_t’ was here
> 1213 | type _mactun_info_t _mactun_info_s
> | ^
> runtime_sysinfo.go:187:19: error: use of undefined type ‘_timespec’
> 187 | type _timestruc_t _timespec
> | ^
> runtime_sysinfo.go:1213:21: error: use of undefined type ‘_mactun_info_s’
> 1213 | type _mactun_info_t _mactun_info_s
> | ^
> runtime_sysinfo.go:741:13: error: use of undefined type ‘_ip6_hdr’
> 741 | type _ip6_t _ip6_hdr
> | ^
> runtime_sysinfo.go:1079:23: error: use of undefined type ‘_zone_net_addr’
> 1079 | type _zone_net_addr_t _zone_net_addr
> | ^
> runtime_sysinfo.go:1127:23: error: use of undefined type ‘_flow_arp_desc_s’
> 1127 | type _flow_arp_desc_t _flow_arp_desc_s
> | ^
> runtime_sysinfo.go:1130:22: error: use of undefined type ‘_flow_l3_desc_s’
> 1130 | type _flow_l3_desc_t _flow_l3_desc_s
> | ^
> runtime_sysinfo.go:1150:20: error: use of undefined type ‘_mac_ipaddr_s’
> 1150 | type _mac_ipaddr_t _mac_ipaddr_s
> | ^
> runtime_sysinfo.go:1210:28: error: use of undefined type ‘_mac_resource_props_s’
> 1210 | type _mac_resource_props_t _mac_resource_props_s
> | ^
> runtime_sysinfo.go:1510:17: error: use of undefined type ‘_mld_hdr’
> 1510 | type _mld_hdr_t _mld_hdr
> | ^
> runtime_sysinfo.go:1519:17: error: use of undefined type ‘_mld2mar’
> 1519 | type _mld2mar_t _mld2mar
> | ^
> runtime_sysinfo.go:1535:29: error: use of undefined type ‘_nd_neighbor_solicit’
> 1535 | type _nd_neighbor_solicit_t _nd_neighbor_solicit
> | ^
> runtime_sysinfo.go:1538:28: error: use of undefined type ‘_nd_neighbor_advert’
> 1538 | type _nd_neighbor_advert_t _nd_neighbor_advert
> | ^
> runtime_sysinfo.go:1541:21: error: use of undefined type ‘_nd_redirect’
> 1541 | type _nd_redirect_t _nd_redirect
> | ^
> runtime_sysinfo.go:1548:28: error: use of undefined type ‘_nd_opt_prefix_info’
> 1548 | type _nd_opt_prefix_info_t _nd_opt_prefix_info
> | ^
> make: *** [Makefile:2959: runtime.lo] Error 1
>
> Comparing runtime_sysinfo.go with a slightly older version in two
> instances:
>
> -type ___gnuc_va_list *int8
> -type ___va_list *int8
> -type ___FILE struct { _cnt int32; _ptr *uint8; _base *uint8; _flag uint8; _magic uint8; Godump_0_pad [2]byte; }
> +type ___FILE ___FILE
>
> +type _mld_hdr_t _mld_hdr
>
> -type _mld_hdr_t struct { mld_icmp6_hdr _icmp6_hdr; mld_addr [16]byte; }
> +type _mld_hdr_t _mld_hdr
>
> Rainer
>
> --
> -----------------------------------------------------------------------------
> Rainer Orth, Center for Biotechnology, Bielefeld University
next prev parent reply other threads:[~2020-12-10 19:31 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-08 22:57 Nikhil Benesch
2020-12-10 2:48 ` Ian Lance Taylor
2020-12-10 19:18 ` Rainer Orth
2020-12-10 19:31 ` Nikhil Benesch [this message]
2020-12-10 19:34 ` Rainer Orth
2020-12-10 19:49 ` Nikhil Benesch
2020-12-10 21:44 ` Rainer Orth
2020-12-13 21:55 ` Nikhil Benesch
2020-12-13 23:30 ` Nikhil Benesch
2020-12-14 7:39 ` Ian Lance Taylor
2020-12-14 8:22 ` Nikhil Benesch
2020-12-14 10:30 ` Rainer Orth
2020-12-15 3:14 ` Nikhil Benesch
2020-12-15 3:34 ` Ian Lance Taylor
2020-12-15 3:48 ` Nikhil Benesch
2020-12-15 8:00 ` Nikhil Benesch
2020-12-16 14:00 ` Nikhil Benesch
2020-12-16 19:20 ` Rainer Orth
2020-12-16 20:13 ` Nikhil Benesch
2020-12-17 4:59 ` Nikhil Benesch
2020-12-17 12:28 ` Rainer Orth
2020-12-17 16:31 ` Nikhil Benesch
2020-12-17 18:05 ` Ian Lance Taylor
2020-12-17 18:21 ` Nikhil Benesch
2020-12-21 4:16 ` Ian Lance Taylor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPWqQZRp8BKBBz3bfzKH543bY7g28aHp+idObjHk7Ot3Fr1RwQ@mail.gmail.com \
--to=nikhil.benesch@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gcc-patches@gnu.org \
--cc=iant@google.com \
--cc=ro@cebitec.uni-bielefeld.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).