Help with SH2E -O2 instruction ordering with volatile
Sun Dec 20 10:33:00 GMT 2015
On 20/12/15 07:14, Alex Brown wrote:
> I know the code is somewhat weird ;-)
> Basically peripheral.e wants the address of a null terminated string
> (not the char value).
> My "platform/emulator" will use DMA to extract the string from RAM
> before the next instruction is executed.
> The issue is that at the time the address is assigned to peripheral.e
> is seems the values of the text array have not yet been written to the
> stack (or that's what I thing I am seeing).
> Making "text" volatile makes it output code that makes sense to me.
The cast to unsigned really isn't helping. My suspicion is
that if t.e has the correct type -- char* -- GCC will do the
right thing. If not, it's a bug in GCC. I am assuming that
lock and unlock are volatile or effectively volatile. If not,
they should be.
More information about the Gcc-help