This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/53937] Pack'ing struct causes gcc to not recognize that an field's address is aligned
- From: "don.delfin at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 12 Jul 2012 12:46:31 +0000
- Subject: [Bug c/53937] Pack'ing struct causes gcc to not recognize that an field's address is aligned
- Auto-submitted: auto-generated
- References: <bug-53937-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53937
Krzysztof Gongolewski <don.delfin at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|missed-optimization |
Status|ASSIGNED |RESOLVED
Resolution| |INVALID
--- Comment #5 from Krzysztof Gongolewski <don.delfin at gmail dot com> 2012-07-12 12:46:31 UTC ---
I added __attribute__((aligned(4))) to my packed structure, and this convinced
gcc compiler that my struct and also the member IS aligned. All mentioned
functions was optimized.
For me it is enough workaround, but I think it is bug in gcc, because
hard-coded address convince compiler that the struct is aligned but doesn't
convince that the member is aligned. And using align attribute convince
compiler that both the structure and the member are aligned.
In my opinion both options (hard-coding address and adding align attribute)
should convince that both struct and member are aligned and result in the same
optimized outputs.