Help with SH2E -O2 instruction ordering with volatile

Andrew Haley aph@redhat.com
Sun Dec 20 11:05:00 GMT 2015


On 20/12/15 10:33, Andrew Haley wrote:
> 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.

Ah, I just looked at the code again.  For this to be really correct,
there has to be some sort of barrier after text is written.  Sorry.

Andrew.



More information about the Gcc-help mailing list