From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26138 invoked by alias); 1 Aug 2013 23:06:47 -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 Received: (qmail 26050 invoked by uid 48); 1 Aug 2013 23:06:45 -0000 From: "jamborm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/58041] Unaligned access to arrays in packed structure Date: Thu, 01 Aug 2013 23:06:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jamborm at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: wschmidt at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-08/txt/msg00063.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58041 --- Comment #19 from Martin Jambor --- (In reply to Bill Schmidt from comment #15) > Bernd, Mikael, Martin: Could you please test this on your respective > targets? Well, "my target" is x86_64 but yes, it works. (In reply to Bill Schmidt from comment #11) > Hi Martin, > > Your assumptions are correct, but I'm not sure this is the best place to > handle it. It looks like what you are doing is replacing one already > correct memory reference with another, both of which will generate somewhat > nasty code. Therefore there isn't much reason to do the transformation at > all in the first place. I think I would rather analyze the reference when > considering adding the reference to the candidate table, and leaving it out > of consideration altogether. What do you think? I don't know, at least in theory the optimization might help somewhat anyway, especially on targets that can handle misalignment memory accesses. But you are right that generally misaligned access will be slow either way. Anyway, I don't really care, I assume you contributed the code so you are more qualified to make a judgment and if you prefer one way over the other, go for it. I'll leave it to you and won't submit any patch then. Please make sure that the two testcases are added to the testsuite before you close the bug. The x86_64-linux tetcase from comment #10 is generic enough that it can go to gcc.dg/torture/, the original ARM one needs to go to some arm-specific place.