------- Additional Comments From gcc2eran at tromer dot org 2005-07-03 04:55 ------- Why was this bug closed? The testcases in comment 5 do *not* pass.
Here's the first testcase, fixed to compile cleanly: ---------------- int avail; int main() { volatile int **outside = (volatile int**)0x0123; *outside = &avail; // avail is now potentially modifiable externally to the program while (*(volatile int *)&avail == 0) continue; return 0; } ---------------- Following the reasoning of comment 5, the read in the loop must not be optimized away. Still, gcc 4.0.0 with -O3 produces this: ---------------- ... movl $avail, 291 movl avail, %eax testl %eax, %eax je .L5 xorl %eax, %eax leave ret .L5: jmp .L5 ---------------- -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21568