Andrew Haley wrote:
> eCos@ wrote:

>> ===============================================
>> int *p;
>>
>> int main(void)
>> {
>>         p++;
>>         __asm__ __volatile__ (""::);
>>         p++;
>> }
>> ===============================================

>> assembly code is like: 
>> 'addl $4, %eax'
>> 'addl $4, %eax'

>> ===============================================
>> int *p;
>>
>> int main(void)
>> {
>>         p++;
>>         __asm__ __volatile__ (""::);
>>         p+=8;
>> }
>> ===============================================

>> According to the assembly code, we found that gcc merge the 'p++' & 'p+=8' 
>> and generate 'addl $36, p'

> If you really need a memory barrier, you have to use one:

  So, this is a real bug then - but it's a missed optimisation in the first
case, not a bogus one in the second case?

    cheers,
      DaveK

Reply via email to