This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/21568] [4.0/4.1 regression] Casts in folding *& omitted
- From: "gcc2eran at tromer dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Jul 2005 04:55:12 -0000
- Subject: [Bug tree-optimization/21568] [4.0/4.1 regression] Casts in folding *& omitted
- References: <20050514140942.21568.rguenth@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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