From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1146 invoked by alias); 1 Aug 2012 02:46:26 -0000 Received: (qmail 1130 invoked by uid 9651); 1 Aug 2012 02:46:25 -0000 Date: Wed, 01 Aug 2012 02:46:00 -0000 Message-ID: <20120801024625.1128.qmail@sourceware.org> From: vapier@sourceware.org To: src-cvs@sourceware.org Subject: src/libiberty ChangeLog md5.c Mailing-List: contact src-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: src-cvs-owner@sourceware.org X-SW-Source: 2012-q3/txt/msg00005.txt.bz2 CVSROOT: /cvs/src Module name: src Branch: binutils-2_23-branch Changes by: vapier@sourceware.org 2012-08-01 02:46:25 Modified files: libiberty : ChangeLog md5.c Log message: 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 ‘md5_finish_ctx’: 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. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/libiberty/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_23-branch&r1=1.611&r2=1.611.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/libiberty/md5.c.diff?cvsroot=src&only_with_tag=binutils-2_23-branch&r1=1.12&r2=1.12.6.1