https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66226
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |msebor at gcc dot gnu.org Resolution|--- |INVALID --- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- Both AIX and POSIX require that: In this hints structure, all members other than ai_flags, ai_eflags ai_family, ai_socktype, and ai_protocol must be zero or a NULL pointer. The program fails to set to zero the ai_addrlen member which causes the function to fail (with both gcc and xlc). Once ai_addrlen is set to zero, the program behaves as you expect.