public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/84544] Missing warning when returning a reference to internal variable inside a lambda
       [not found] <bug-84544-4@http.gcc.gnu.org/bugzilla/>
@ 2021-12-17  3:27 ` pinskia at gcc dot gnu.org
  2021-12-17  3:29 ` pinskia at gcc dot gnu.org
  2022-01-16  0:44 ` msebor at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-17  3:27 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-12-17

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I have seen something similar too.

Confirmed.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/84544] Missing warning when returning a reference to internal variable inside a lambda
       [not found] <bug-84544-4@http.gcc.gnu.org/bugzilla/>
  2021-12-17  3:27 ` [Bug c++/84544] Missing warning when returning a reference to internal variable inside a lambda pinskia at gcc dot gnu.org
@ 2021-12-17  3:29 ` pinskia at gcc dot gnu.org
  2022-01-16  0:44 ` msebor at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-17  3:29 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |antoshkka at gmail dot com

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 90647 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/84544] Missing warning when returning a reference to internal variable inside a lambda
       [not found] <bug-84544-4@http.gcc.gnu.org/bugzilla/>
  2021-12-17  3:27 ` [Bug c++/84544] Missing warning when returning a reference to internal variable inside a lambda pinskia at gcc dot gnu.org
  2021-12-17  3:29 ` pinskia at gcc dot gnu.org
@ 2022-01-16  0:44 ` msebor at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: msebor at gcc dot gnu.org @ 2022-01-16  0:44 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
This should be easily detectable even without optimization by the new
-Wdangling-pointer.  I think it's essentially equivalent to the following test
case:

$ cat t.C && gcc -S -Wall -fdump-tree-waccess1=/dev/stdout t.C
struct A
{
  int &r;
};

A f ()
{
  int x = 0;
  return A{ x };
}

;; Function f (_Z1fv, funcdef_no=0, decl_uid=2373, cgraph_uid=1,
symbol_order=0)
...
struct A f ()
{
  int x;
  struct A D.2386;

  <bb 2> :
  x = 0;
  D.2386.r = &x;     <<< not handled by -Wdangling-pointer
  x ={v} {CLOBBER};

  <bb 3> :
<L1>:
  return D.2386;     <<<

}

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-16  0:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-84544-4@http.gcc.gnu.org/bugzilla/>
2021-12-17  3:27 ` [Bug c++/84544] Missing warning when returning a reference to internal variable inside a lambda pinskia at gcc dot gnu.org
2021-12-17  3:29 ` pinskia at gcc dot gnu.org
2022-01-16  0:44 ` msebor at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).