--- Comment #1 from rguenth at gcc dot gnu dot org 2010-02-04 10:03 ---
Confirmed. Fails with -O -fno-tree-pta as well.
extern void abort (void);
static int g[1];
static int *p = g[0];
static int *q = g[0];
int main(void)
{
g[0] = 1;
*p = 0;
*p = *q;
if (g[0] != 0)
--- Comment #3 from rguenth at gcc dot gnu dot org 2010-02-04 10:33 ---
Well, dse puts
(mem/u/f/c/i:DI (symbol_ref:DI (q) [flags 0x2] var_decl 0x75ae7140 q)
[0 q+0 S8 A64])
(mem/u/f/c/i:DI (symbol_ref:DI (p) [flags 0x2] var_decl 0x75ae70a0 p)
[0 p+0 S8 A64])
into different
--- Comment #4 from rguenth at gcc dot gnu dot org 2010-02-04 10:36 ---
The only addresses treated as the dse constant kind should be symbol-refs.
Or we need to lookup the constant initializer the constant mem refers to
and use that (but I have no idea if that's easily possible on RTL).
--- Comment #5 from zadeck at naturalbridge dot com 2010-02-04 14:57
---
Richi, you are, of course, correct.
kenny
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42952
--- Comment #6 from matz at gcc dot gnu dot org 2010-02-04 15:03 ---
Re comment #4, there are two possibilities to fix this:
1) as you say, don't regard MEM addresses (i.e. used in double indirection)
as const_or_frame_p, because that would put different (but runtime-same)
bases