--- Comment #6 from rguenth at gcc dot gnu dot org 2007-07-13 12:36 ---
Basically we could just make sure to preserve TREE_THIS_VOLATILE on folded
memory references *&spinlock[0] (where the indirect reference has this flag
set, but the result from maybe_fold_offset_to_reference, spinlock
--- Comment #5 from rguenth at gcc dot gnu dot org 2007-07-13 12:19 ---
Actually, the optimized dump ist still correct:
main ()
{
int D.2011;
:
spinlock[0] = 0;
spinlock[1] = 0;
:
D.2011 = spinlock[0];
if (D.2011 != 0)
goto ;
else
goto ;
:
return;
}
spinlock[0
--- Comment #4 from rguenther at suse dot de 2007-07-11 08:45 ---
Subject: Re: CCP removes volatile qualifiers.
On Tue, 10 Jul 2007, ramana dot radhakrishnan at celunite dot com wrote:
> (In reply to comment #2)
> > As the decl is volatile as well this is clearly a bogus optimization.
--- Comment #3 from ramana dot radhakrishnan at celunite dot com
2007-07-10 20:14 ---
(In reply to comment #2)
> As the decl is volatile as well this is clearly a bogus optimization.
>
Putting a breakpoint on evaluate_stmt in tree-ssa-ccp.c shows that stmt_ann of
the stmt does not hav
--- Comment #2 from rguenth at gcc dot gnu dot org 2007-07-10 16:19 ---
As the decl is volatile as well this is clearly a bogus optimization.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32721
--- Comment #1 from rguenth at gcc dot gnu dot org 2007-07-10 16:15 ---
Indeed. CCP propagates the constant addresses &spinlock and &spinlock[1] to
the deref sides which loses the volatile qualifier from the access. Disabling
that leads to VRP which does the same. Then DOM which does