Jari Kuusisto <jari.h.kuusisto@xxxxxxxxx> writes: > After upgrading from gcc 2.95.3 to 4.3.2 the critical section handling > in the code stopped working. It seems that some of the code that > should be in critical section seems to be relocated outside the > critical section. I do know that asm volatile does not guarantee > consecutive execution of the code. I also know that using singe asm > would fix this problem, but in my case it is not possible. > > I've managed to to get around this problem by replacing the critical > section macros with assembler functions as the blr instruction forces > the correct consecutive operation when entering and exiting critical > section. However, this function call type implementation seems to > significantly slow down runtime operation of the software. The result > is that the performance improvement gained with new gcc optimizations > is waisted due to this function call type implementation. > > If I enable all other optimizations from -O2 but not the > -freorder-blocks the code is working with the old asm volatile macros, > but this is not an option. > > Is there any other way to force the consecutive operation of asm > volatile macros? You're going to have to show us the code. Ian