https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81273

--- Comment #3 from LdB <ldeboer at gateway dot net.au> ---
I am stunned you could not build the code the only requirement is you include
the stdint.h so the uint32_t types are defined. I will fix the typos are you
really saying you can't compile this?

#include <stdint.h>
struct __attribute__((__packed__)) TimerRegisters {
        volatile uint32_t Load; //0x00
        volatile uint32_t Value; //0x04
};

uint32_t base_addr = 0x3F000000;
#define TIMER ((struct TimerRegisters*)(base_addr + 0xB400))

void ShowBug (void){
   TIMER->Load =  0x400; // -02 compile and look at code
}

void ShowFix1 (void){
    *(volatile uint32_t*)TIMER->Load =  0x400;
}

void ShowFix2 (void){
    volatile uint32_t temp = 0x400;
    TIMER->Load =  temp;
}

Alignment is not really a concern it's a hardware register to the CPU so it's a
given.

Reply via email to