Aliasing violations in gnu_java_nio_VMChannel.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This:


#ifdef HAVE_GETPEERNAME
#ifdef HAVE_INET6
  struct sockaddr_in6 *addr6;
  struct sockaddr_in6 sock_storage;
  socklen_t socklen = sizeof (struct sockaddr_in6);
#else
  struct sockaddr_in sock_storage;
  socklen_t socklen = sizeof (struct sockaddr_in);
#endif /* HAVE_INET6 */

  struct sockaddr *sockaddr = (struct sockaddr *) &sock_storage;


is clearly an aliasing violation: sock_storage is of type struct sockaddr_in6,
and *sockaddr is of type struct sockaddr.

It would be easy enough to fix the code with a union, but I can't test it
because gcj doesn't use this code.  I could simply compile with
-fno-strict-aliasing.

Thoughts?

Andrew.


[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux