[Bug c/53937] Pack'ing struct causes gcc to not recognize that an field's address is aligned
don.delfin at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jul 12 12:46:00 GMT 2012
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.
More information about the Gcc-bugs
mailing list