------- Additional Comments From paul dot woegerer at nsc dot com 2005-07-06
10:55 -------
Sorry i thought this trivial test case is self-explanatory.
I would expect that main returns 0.
Two pointers pointing to the same volatile int should compare
to equal (as they do when I disable dominator optimizations
with -fno-tree-dominator-opts) - no matter if one of them is
const qualified.
With -O1 (which implies -ftree-dominator-opts) main returns -1.
With -O1 -fno-tree-dominator-opts main returns 0.
Do you really think that this bug is target specific ? I've taken
a look to the tree dumps and they show that the code gets already
corruped on tree level (as you can see in the *.t21.dom1 file).
-------------------------------------------- testcase.c.t20.dce1
int main() ()
{
const int * cvip;
volatile int * vip;
int D.1597;
<bb 0>:
vip_2 = &x;
cvip_3 = vip_2;
if (vip_2 != cvip_3) goto <L0>; else goto <L1>;
<L0>:;
D.1597_6 = -1;
goto <bb 3> (<L2>);
<L1>:;
D.1597_5 = 0;
# D.1597_1 = PHI <D.1597_6(1), D.1597_5(2)>;
<L2>:;
return D.1597_1;
}
-------------------------------------------- testcase.c.t21.dom1
Removing basic block 2
Merging blocks 0 and 1
int main() ()
{
const int * cvip;
volatile int * vip;
int D.1597;
<bb 0>:
vip_2 = &x;
cvip_3 = &x;
D.1597_6 = -1; <---------------
# D.1597_1 = PHI <-1(0)>;
<L2>:;
return D.1597_1;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22321