From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32342 invoked by alias); 2 Aug 2013 16:58:43 -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 32089 invoked by uid 48); 2 Aug 2013 16:58:40 -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: Fri, 02 Aug 2013 16:58: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: jamborm at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: assigned_to attachments.created 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/msg00144.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58041 Martin Jambor changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|wschmidt at gcc dot gnu.org |jamborm at gcc dot gnu.org --- Comment #24 from Martin Jambor --- Created attachment 30594 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30594&action=edit Proposed patch (In reply to Bill Schmidt from comment #20) > After thinking it over some more, I think you are right, Martin. We should > go ahead with the optimization with the corrected alignment attached to the > type. Please go ahead with your patch. I will run a round of regression > testing on PowerPC (an architecture for which the generic test produces > misaligned but legal memory references) as well. > > Sorry for going back and forth on this. I try to avoid wasting compile time > on useless transformations, but in this case we will still see some benefit > in some cases, and the code should be no worse than before when we don't. > No worries, I'm currently bootstrapping and testing the attached patch. I'm bootstrapping on x86_64-linux and with bugs like this one, any additional testing on other platforms is very welcome. (In reply to Bill Schmidt from comment #21) > My only comment on the patch would be to please add commentary indicating > why the change is being made, and referencing this PR. Something along the > lines of: > > /* Ensure the memory reference carries the minimum alignment > requirement for the data type. Some targets (e.g., ARM) > can't always handle an unaligned reference otherwise. See PR58041. */ > > ...or something like that. > The alignment information should be there regardless of the target so I just used the first sentence and the PR reference. I hope that is enough. Thanks.