On Sun, Oct 13, 2002 at 07:29:24PM +1000, [EMAIL PROTECTED] wrote: > Package: gcc-3.2 > Version: 1:3.2.1-0pre2 > Severity: normal > > The following program produces output where the assignment to j occurs > before the i has been incremented. This breaks any program using such > constructs to ensure consistency: > > volatile int i; > int j; > > void a() { > i++; > j = 6; > i--; > } > > .prologue 1 > ldq $3,i($29) !literal > lda $4,6($31) > ldq $1,j($29) !literal > ldl $2,0($3) > stl $4,0($1) > lda $2,1($2) > stl $2,0($3)
I don't see the problem. Volatile in C doesn't provide any sort of barrier; you have to place one yourself if you want one. It only guaranatees that the two accesses to "i" will not be reordered or eliminated. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer