[PATCHes] Misc aliasing fixes for building DLL with gcc-4.5.0

Yaakov (Cygwin/X) yselkowitz@users.sourceforge.net
Tue Aug 17 19:23:00 GMT 2010


On Mon, 2009-08-10 at 04:11 +0100, Dave Korn wrote:
>   I tried compiling winsup with GCC-4.5.0 HEAD, and it finds a bunch of things
> to complain about (which then break the -Werror build).  They are mostly
> "dereferencing type-punned pointer will break strict-aliasing rules" errors, but
> there is also some possibly-undefined behaviour in passwd.cc (looks like a
> problem with sequence points to me).

Sorry to resurrect such an old thread, but now that Dave released
gcc-4.5, this is no longer theoretical.  Here are the warnings-as-errors
that I get with gcc-4.5.1 with Dave's 4.5.0 patch set:

winsup/cygwin/fhandler_floppy.cc: In member function ‘int
fhandler_dev_floppy::get_drive_info(hd_geometry*)’:
winsup/cygwin/fhandler_floppy.cc:59:37: error: dereferencing type-punned
pointer will break strict-aliasing rules

winsup/cygwin/fhandler_socket.cc: In function ‘bool address_in_use(const
sockaddr*)’:
winsup/cygwin/fhandler_socket.cc:918:7: error: dereferencing type-punned
pointer will break strict-aliasing rules
winsup/cygwin/fhandler_socket.cc:918:7: error: dereferencing type-punned
pointer will break strict-aliasing rules

winsup/cygwin/hookapi.cc: In function ‘void* hook_or_detect_cygwin(const
char*, const void*, WORD&)’:
winsup/cygwin/hookapi.cc:255:7: error: ‘i’ may be used uninitialized in
this function

winsup/cygwin/passwd.cc: In function ‘passwd*
internal_getpwsid(cygpsid&)’:
winsup/cygwin/passwd.cc:101:54: error: operation on ‘pw’ may be
undefined

winsup/cygwin/syscalls.cc: In function ‘long int gethostid()’:
winsup/cygwin/syscalls.cc:3711:43: error: dereferencing type-punned
pointer will break strict-aliasing rules
winsup/cygwin/syscalls.cc:3712:49: error: dereferencing type-punned
pointer will break strict-aliasing rules


Yaakov




More information about the Cygwin-patches mailing list