]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
libiberty/md5: fix strict alias warnings
authorMike Frysinger <vapier@gentoo.org>
Tue, 31 Jul 2012 09:02:35 +0000 (09:02 +0000)
committerMike Frysinger <vapier@gentoo.org>
Tue, 31 Jul 2012 09:02:35 +0000 (09:02 +0000)
commit902e4335501e73ad45ad2ebc2510b1d41786873f
tree2699b97dd537d8bbf8605c398d4a18106bb55469
parent4a2608e354d22289f40944bb29d85db3f3c5ca04
libiberty/md5: fix strict alias warnings

Current libiberty md5 code triggers these warnings with gcc-4.7.1 for me:

libiberty/md5.c: In function â\80\98md5_finish_ctxâ\80\99:
libiberty/md5.c:117:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
libiberty/md5.c:118:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

The change below fixes things for me.  The optimized output (-O2) is the same
before/after my change on x86_64-linux.  I imagine it'll be the same for most
targets.  It seems simpler than using a union on the md5_ctx buffer since these
are the only two locations in the code where this occurs.
libiberty/ChangeLog
libiberty/md5.c