Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix strict aliasing issues #336

Merged
merged 1 commit into from
Feb 17, 2016
Merged

Fix strict aliasing issues #336

merged 1 commit into from
Feb 17, 2016

Conversation

ellert
Copy link
Contributor

@ellert ellert commented Feb 17, 2016

/builddir/build/BUILD/xrootd-4.2.3/src/XrdSys/XrdSysDNS.cc: In static member function 'static int XrdSysDNS::getAddrName(const char*, int, char**, char**, char**)':
/builddir/build/BUILD/xrootd-4.2.3/src/XrdSys/XrdSysDNS.cc:187:51: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
       int hn = getHostName((struct sockaddr &)ip[i], names, 1, errtxt);
                                                   ^
/builddir/build/BUILD/xrootd-4.2.3/src/XrdSys/XrdSysDNS.cc: In static member function 'static int XrdSysDNS::Host2Dest(const char*, sockaddr&, char**)':
/builddir/build/BUILD/xrootd-4.2.3/src/XrdSys/XrdSysDNS.cc:522:47: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
    if (!getHostAddr(hbuff, (struct sockaddr &)InetAddr, errtxt)) return 0;
                                               ^~~~~~~~
/builddir/build/BUILD/xrootd-4.2.3/src/XrdSys/XrdSysDNS.cc: In static member function 'static int XrdSysDNS::Host2IP(const char*, unsigned int*)':
/builddir/build/BUILD/xrootd-4.2.3/src/XrdSys/XrdSysDNS.cc:550:47: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
    if (!getHostAddr(hname, (struct sockaddr &)InetAddr)) return 0;
                                               ^~~~~~~~

abh3 added a commit that referenced this pull request Feb 17, 2016
@abh3 abh3 merged commit 9a99303 into xrootd:master Feb 17, 2016
@abh3
Copy link
Member

abh3 commented Feb 17, 2016

Thank you Mattias for the fix. We thought we would do this using unions but your solution is just as nice :-)

@ellert ellert deleted the sockaddr-aliasing branch February 17, 2016 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants