https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89583
Bug ID: 89583 Summary: GNAT.Sockets.Bind_Socket fails with IPv4 address Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada Assignee: unassigned at gcc dot gnu.org Reporter: simon at pushface dot org Target Milestone: --- Created attachment 45886 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45886&action=edit Reproducer On Darwin 18.2.0 (Mojave), gcc (GCC) 9.0.1 20190219 (experimental), GNAT.Sockets.Bind_Socket fails if given an IPv4 address. I believe that this is caused by the introduction of the new IPv6-aware Sockaddr, which is an Unchecked_Union where the size in bytes can be 4 (unspec), 16 (IPv4) or 28 (IPv6) bytes; when Bind_Socket says Sin : aliased Sockaddr; Len : constant C.int := Sin'Size / 8; begin Set_Address (Sin'Unchecked_Access, Address); Res := C_Bind (C.int (Socket), Sin'Address, Len); it sets Len to be 28, and macOS (darwin 15, darwin 18) says this is an invalid argument; see demonstrator.