------- Additional Comments From bjoern dot m dot haase at web dot de  
2005-10-01 18:46 -------
The question merely is to find out if this is a bug / a bug of the 
documentation or no bug at all.  
 
After the fix for PR22000 the actual issue I had stepped over originally is 
indeed fixed: The protection of volatile *variables* now indeed works. The 
question that is still open, however, is:  Is gcc generally allowed to schedule 
statements across asm volatile statements?  E.g. look at an hypothetical 
example where someone would, e.g. like to disable irqs for speed reasons. 
     
    asm volatile ("/* disable irq */" : : );                // 1 
    for (i=0; i < 1000; i++)                                // 2 
      { 
        a [i] *= 3; 
      } 
    asm volatile ("/* enable irq */" : : );                 // 3 
 
After reading the specs "In addition, GCC will not reschedule instructions 
across a volatile `asm' instruction.", I still think that we either  
 
1) still have a bug or 
2) have a documentation that "caused at least some people to understand it 
differently from than it was meant to be understood" (saying this in order to 
avoid the terminus documentation bug). 
 
In case that scheduling is meant to be allowed if no volatile variable access 
is concerned, we probably would need to change the present implementation of 
irq disabling in the avr-libc's header files. 
 
Bjoern 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24165

Reply via email to