------- Comment #13 from rguenth at gcc dot gnu dot org 2009-06-10 20:58
-------
Well. I see as final difference (no SRA vs. with SRA)
<bb 2>:
D.2249 = baz (); [return slot optimization]
- D.2417_8 = D.2249.a;
- g.a = D.2417_8;
- D.2415_10 = &D.2417_8->k;
+ SR.101_9 = D.2249.a;
+ SR.102_31 = D.2249.p;
+ SR.103_32 = D.2249.n;
+ g.a = SR.101_9;
+ D.2415_10 = &SR.101_9->k;
S<H>::bar (D.2415_10, &g);
- if (D.2417_8 != 0B)
+ if (SR.101_9 != 0B)
goto <bb 3>;
else
goto <bb 9>;
<bb 3>:
- D.2421_13 = D.2249.p;
- if (D.2421_13 != 0B)
+ if (SR.102_31 != 0B)
goto <bb 4>;
else
goto <bb 5>;
<bb 4>:
- D.2422_15 = D.2249.n;
- D.2421_13->n = D.2422_15;
+ SR.102_31->n = SR.103_32;
goto <bb 6>;
etc.
So you say that
D.2249 = baz (); [return slot optimization]
- D.2417_8 = D.2249.a;
- g.a = D.2417_8;
makes D.2249.a escape and thus
S<H>::bar (D.2415_10, &g);
is allowed to modify D.2249.a because D.2249.a->... may point to D.2249
itself?
If
D.2249 = baz (); [return slot optimization]
makes D.2249 escape then this is a bug in both points-to analysis and
addressability analysis (the C++ FE should then make sure to set
TREE_ADDRESSABLE on D.2249 as well if it doesn't do so already).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40389