From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29625 invoked by alias); 6 Nov 2009 09:16:19 -0000 Received: (qmail 29557 invoked by alias); 6 Nov 2009 09:16:01 -0000 Date: Fri, 06 Nov 2009 09:16:00 -0000 Message-ID: <20091106091601.29556.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/41874] Incorrect "dereferencing type-punned pointer will break strict-aliasing rules" warning In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenther at suse dot de" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-11/txt/msg00518.txt.bz2 ------- Comment #2 from rguenther at suse dot de 2009-11-06 09:16 ------- Subject: Re: Incorrect "dereferencing type-punned pointer will break strict-aliasing rules" warning On Fri, 6 Nov 2009, pinskia at gcc dot gnu dot org wrote: > ------- Comment #1 from pinskia at gcc dot gnu dot org 2009-11-06 09:09 ------- > 4.5 also fails and I cannot figure why if I do: "fails"? > #include > struct APInt { > int i; > }; > int main() { > APInt I; > void *d; > char Data[sizeof(APInt)]; > new((void*)Data)APInt(); > d = Data; > *(APInt*)d = I; > } > > GCC does not warn. Of course not - the code is perfectly valid (apart from Data not having suitable alignment for APInt, but that's unrelated to aliasing issues). Richard. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41874