http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56341
Bug #: 56341
Summary: GCC produces unaligned data access
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c
AssignedTo: [email protected]
ReportedBy: [email protected]
Created attachment 29464
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29464
test program produces alignment faults
Hello,
The attached test program causes two problems when compiled with GCC 4.6.3 for
ARM:
1. test() fails to write the high word of an unaligned volatile struct member.
2. test1() crashes because it uses an unaligned word access.
This code did compile and execute correctly with GCC 4.3.2
As a workaround, the bug goes away if the code is compiled with
-fno-strict-volatile-bitfields,
but this is probably less efficient code.
The attached patch is a backport of the following patch, and seems to resolve
this issue:
http://gcc.gnu.org/ml/gcc-patches/2012-08/msg01449.html
the original patch ignored the alignment of the target, and fixed only the
first test case, but not the crash in the second test case.
Regards
Bernd Edlinger