From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31961 invoked by alias); 19 Mar 2012 10:55:16 -0000 Received: (qmail 31952 invoked by uid 22791); 19 Mar 2012 10:55:15 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 19 Mar 2012 10:54:51 +0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug other/52609] -Wstrict-aliasing / missed diagnostics Date: Mon, 19 Mar 2012 10:57:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: other X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2012-03/txt/msg01504.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52609 --- Comment #3 from Richard Guenther 2012-03-19 10:54:24 UTC --- (In reply to comment #2) > (In reply to comment #1) > > >accessing unsigned* via float* looks buggy > > > > It does not have to be if the original argument was originally of type float. > > Aliasing is not about type of pointers but the type which is used to access and > > such. > > ok, here's an updated testcase: > > $ cat alias-bug.c > unsigned buffer[1]; > > float bug1( unsigned u ) > { > buffer[0]=u; > return *(float*)(&buffer[0]); // warning. > } > > float bug2( unsigned u ) > { > buffer[0]=u; > float* ptr=(float*)&buffer[0]; > return *ptr; // missed strict aliasing warning. > } > > gcc repots warning only for bug1() and misses warning for bug2(): There is a duplicate bug for this somewhere. The warning machinery only looks at a single stmt.