* [Bug c++/97256] auto function return different result
2020-09-30 14:08 [Bug c++/97256] New: auto function return different result tangyixuan at mail dot dlut.edu.cn
@ 2020-09-30 15:00 ` rguenth at gcc dot gnu.org
2020-10-01 10:01 ` redi at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-30 15:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97256
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
possibly this returns a reference to a local variable which is undefined?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97256] auto function return different result
2020-09-30 14:08 [Bug c++/97256] New: auto function return different result tangyixuan at mail dot dlut.edu.cn
2020-09-30 15:00 ` [Bug c++/97256] " rguenth at gcc dot gnu.org
@ 2020-10-01 10:01 ` redi at gcc dot gnu.org
2020-10-01 10:01 ` redi at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2020-10-01 10:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97256
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes, the lambda captures a local variable by value, and then when you invoke
the lambda it refers to a dead variable.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97256] auto function return different result
2020-09-30 14:08 [Bug c++/97256] New: auto function return different result tangyixuan at mail dot dlut.edu.cn
2020-09-30 15:00 ` [Bug c++/97256] " rguenth at gcc dot gnu.org
2020-10-01 10:01 ` redi at gcc dot gnu.org
@ 2020-10-01 10:01 ` redi at gcc dot gnu.org
2020-10-02 1:00 ` richard-gccbugzilla at metafoo dot co.uk
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2020-10-01 10:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97256
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #2)
> Yes, the lambda captures a local variable by value,
Duh, sorry, I meant captures a local variables BY REFERENCE.
> and then when you invoke
> the lambda it refers to a dead variable.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97256] auto function return different result
2020-09-30 14:08 [Bug c++/97256] New: auto function return different result tangyixuan at mail dot dlut.edu.cn
` (2 preceding siblings ...)
2020-10-01 10:01 ` redi at gcc dot gnu.org
@ 2020-10-02 1:00 ` richard-gccbugzilla at metafoo dot co.uk
2020-10-02 1:04 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: richard-gccbugzilla at metafoo dot co.uk @ 2020-10-02 1:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97256
Richard Smith <richard-gccbugzilla at metafoo dot co.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |richard-gccbugzilla@metafoo
| |.co.uk
--- Comment #4 from Richard Smith <richard-gccbugzilla at metafoo dot co.uk> ---
The reference to 'b' from within the lambda is not an odr-use, so is not
transformed into a use of the lambda's capture. This program has defined
behavior and is being miscompiled.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97256] auto function return different result
2020-09-30 14:08 [Bug c++/97256] New: auto function return different result tangyixuan at mail dot dlut.edu.cn
` (3 preceding siblings ...)
2020-10-02 1:00 ` richard-gccbugzilla at metafoo dot co.uk
@ 2020-10-02 1:04 ` mpolacek at gcc dot gnu.org
2020-10-02 4:50 ` richard-gccbugzilla at metafoo dot co.uk
2020-10-02 13:32 ` redi at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-10-02 1:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97256
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
Ever confirmed|0 |1
Resolution|INVALID |---
Status|RESOLVED |NEW
Last reconfirmed| |2020-10-02
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Re-opening then, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97256] auto function return different result
2020-09-30 14:08 [Bug c++/97256] New: auto function return different result tangyixuan at mail dot dlut.edu.cn
` (4 preceding siblings ...)
2020-10-02 1:04 ` mpolacek at gcc dot gnu.org
@ 2020-10-02 4:50 ` richard-gccbugzilla at metafoo dot co.uk
2020-10-02 13:32 ` redi at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: richard-gccbugzilla at metafoo dot co.uk @ 2020-10-02 4:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97256
--- Comment #6 from Richard Smith <richard-gccbugzilla at metafoo dot co.uk> ---
My apologies, I misread the testcase. Yes, this is UB.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97256] auto function return different result
2020-09-30 14:08 [Bug c++/97256] New: auto function return different result tangyixuan at mail dot dlut.edu.cn
` (5 preceding siblings ...)
2020-10-02 4:50 ` richard-gccbugzilla at metafoo dot co.uk
@ 2020-10-02 13:32 ` redi at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2020-10-02 13:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97256
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|NEW |RESOLVED
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
And closing again.
^ permalink raw reply [flat|nested] 8+ messages in thread