From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20688 invoked by alias); 12 Nov 2010 17:35:56 -0000 Received: (qmail 20319 invoked by uid 22791); 12 Nov 2010 17:35:55 -0000 X-SWARE-Spam-Status: No, hits=-2.8 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; Fri, 12 Nov 2010 17:35:08 +0000 From: "ebotcazou at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/45722] [4.6 Regression] FAIL: gcc.c-torture/execute/20040709-2.c execution at -O1 and -Os X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: ebotcazou at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ebotcazou at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.6.0 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 Date: Fri, 12 Nov 2010 17:44: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-11/txt/msg01689.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45722 --- Comment #33 from Eric Botcazou 2010-11-12 17:34:26 UTC --- > The memory has MEM_ALIGN 8, but we of course just ignore that for > STRICT_ALIGNMENT targets. So the situation is similar to the old > mishandling of > > typedef int myint __attribute__((aligned(1))); > > int foo (myint *p) > { > return *p; > } > > int main() > { > char c[5]; > return foo (&c[1]); > } > > where on old GCC releases we don't run into unaligned memory load > handling for STRICT_ALINGMENT targets either (INDIRECT_REF never > tried to handle that case, I tried to cover up for that with > usign movmisalign where available for MEM_REF). Now as the alignment > info on the type of the mem-ref is bogus the > > align = MAX (TYPE_ALIGN (TREE_TYPE (exp)), > get_object_alignment (exp, BIGGEST_ALIGNMENT)); > > hunk will make that handling not trigger anyway. > > So, it's a) SRAs fault to not preserve alignment b) a general and > very very old problem of GCC (the C FE also doesn't have proper > types when taking the address of a field of a packed struct). Yes, accesses to unaligned stuff is an old problem, see for example PR c/18287, and INDIRECT_REFs indeed never tried to handle this. However, this shouldn't be the problem here since there are no indirect accesses involved, it's just: struct E sE; struct E x; x = sE; Why on earth does SRA now introduce indirect accesses to scalarize a direct assignment between 2 structures with the same type?