This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/58041] Unaligned access to arrays in packed structure
- From: "jamborm at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 02 Aug 2013 16:58:40 +0000
- Subject: [Bug middle-end/58041] Unaligned access to arrays in packed structure
- Auto-submitted: auto-generated
- References: <bug-58041-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58041
Martin Jambor <jamborm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|wschmidt at gcc dot gnu.org |jamborm at gcc dot gnu.org
--- Comment #24 from Martin Jambor <jamborm at gcc dot gnu.org> ---
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.