From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11062 invoked by alias); 31 Jul 2012 09:02:38 -0000 Received: (qmail 11037 invoked by uid 9651); 31 Jul 2012 09:02:36 -0000 Date: Tue, 31 Jul 2012 09:02:00 -0000 Message-ID: <20120731090235.11036.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/msg00004.txt.bz2 CVSROOT: /cvs/src Module name: src Changes by: vapier@sourceware.org 2012-07-31 09:02:35 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&r1=1.611&r2=1.612 http://sourceware.org/cgi-bin/cvsweb.cgi/src/libiberty/md5.c.diff?cvsroot=src&r1=1.12&r2=1.13