This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/81273] Wrong code generated for ARM setting volatile struct field with a literal
- From: "ldeboer at gateway dot net.au" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 03 Jul 2017 14:47:04 +0000
- Subject: [Bug target/81273] Wrong code generated for ARM setting volatile struct field with a literal
- Auto-submitted: auto-generated
- References: <bug-81273-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81273
--- Comment #5 from LdB <ldeboer at gateway dot net.au> ---
Okay I understand all that and accept my apology and I will try to follow the
rules exactly in future.
I had to change the alignment command slightly to be valid on ARM 6.3.1
struct __attribute__((__packed__,aligned(__alignof(uint32_t))))TimerRegisters {
volatile uint32_t Load; //0x00
volatile uint32_t Value; //0x04
};
I am getting viable code with that, so it's undeniable it is an alignment
issue.
I am happy to have that as the solution and I understand it is the most
technically correct. It probably needs to be added to the manual because I
suspect it is going to come up a lot. I have never had the compiler spit
unaligned code as the most optimized code before.