This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/81273] Wrong code generated for ARM setting volatile struct field with a literal


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]