From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21975 invoked by alias); 28 Nov 2012 20:00:49 -0000 Received: (qmail 21957 invoked by uid 9651); 28 Nov 2012 20:00:48 -0000 Date: Wed, 28 Nov 2012 20:00:00 -0000 Message-ID: <20121128200048.21955.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-q4/txt/msg00017.txt.bz2 CVSROOT: /cvs/src Module name: src Branch: gdb_7_5-branch Changes by: vapier@sourceware.org 2012-11-28 20:00:48 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. (cherry picked from current cvs HEAD) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/libiberty/ChangeLog.diff?cvsroot=src&only_with_tag=gdb_7_5-branch&r1=1.609&r2=1.609.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/libiberty/md5.c.diff?cvsroot=src&only_with_tag=gdb_7_5-branch&r1=1.12&r2=1.12.4.1