From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28760 invoked by alias); 27 Sep 2010 15:48:40 -0000 Received: (qmail 28743 invoked by uid 22791); 27 Sep 2010 15:48:39 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,MISSING_MID 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, 27 Sep 2010 15:48:34 +0000 From: "anemo at mba dot ocn.ne.jp" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/45704] [4.5 Regression] load byte instruction is used for volatile int X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: anemo at mba dot ocn.ne.jp X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.5.2 X-Bugzilla-Changed-Fields: 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 Date: Mon, 27 Sep 2010 18:12:00 -0000 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: 2010-09/txt/msg02917.txt.bz2 Message-ID: <20100927181200.excTL1zPC2nMncLy84U05iXh-x6JbWEAqBSHj6umCng@z> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45704 --- Comment #5 from Atsushi Nemoto 2010-09-27 15:48:32 UTC --- Here is a similar test case with "packed" attribute, which still produces bad result. Four load-byte instructions are generated instead of one load-word. struct st { int ptr; } __attribute__ ((packed)); int foo(struct st *st) { int v = *(volatile int *)&st->ptr; return v & 0xff; } gcc 4.4.4 works fine (same result with the first test case) gcc 4.6.0 20100927 (or 4.5.2 20100927) generates: lbu $2,0($4) lbu $3,1($4) andi $2,$2,0x00ff lbu $3,2($4) lbu $3,3($4) j $31 nop I do not know this should be another PR or not.