https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79992

--- Comment #14 from Yanai <yanai.eli11 at gmail dot com> ---
> 
> How so?  SRA has
> 
> >   [t1.cc:10:47] [t1.cc:10:47] D.36138.v = [t1.cc:24:29] &[t1.cc:24:20]
> > MEM[(const struct __lambda0 *)[t1.cc:17:42] &D.36138].__i;
> ...
> >   [t1.cc:17:42] D.36138 ={v} {CLOBBER};
> ...
> >   [t1.cc:32:11] _2 = [t1.cc:32:11] *_39;
> 
> so access *_39 after the clobber.  And _39 points to D.36138.
> 
> Clearly this is an invalid testcase.
> 
> static auto get_wrapped_number() {
>     return [i = 1] { return &i; };
> }
> 
> returns an address to automatic storage.

maybe I am repeating myself, but lambda taking a pointer of one of it's members
should not point to the lambda itself?
it's like doing:
auto lambda;
auto v = &lambda.i;
printf(*v);
printf(*v);

or the by the standard it should copy `i` to stack take pointer?
because at other cases that I take pointer of lambda's member I wrote in the
attachment it actually works. (it doesn't work at one specific case)

Reply via email to