public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101799] New: Warning messages for PMF leak internal names like ::__pfn and ::__delta
@ 2021-08-06  8:53 slyfox at gcc dot gnu.org
  2021-08-06 16:55 ` [Bug middle-end/101799] " msebor at gcc dot gnu.org
  2021-08-06 17:01 ` msebor at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: slyfox at gcc dot gnu.org @ 2021-08-06  8:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101799
           Summary: Warning messages for PMF leak internal names like
                    ::__pfn and ::__delta
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

Found when poked at https://gcc.gnu.org/PR101219. Might be related to
https://gcc.gnu.org/PR96989.

$ cat a.cc
struct S { void m(); };

bool f() {
  void (S::*mp)();

  return &S::m == mp; // use uninitialized
}

$ g++ -c -Wall a.cc
a.cc: In function 'bool f()':
a.cc:6:19: warning: 'mp.void (S::*)()::__pfn' is used uninitialized
[-Wuninitialized]
    6 |   return &S::m == mp; // use uninitialized
      |                   ^~
a.cc:4:13: note: 'mp' declared here
    4 |   void (S::*mp)();
      |             ^~
a.cc:6:19: warning: 'mp.void (S::*)()::__delta' may be used uninitialized
[-Wmaybe-uninitialized]
    6 |   return &S::m == mp; // use uninitialized
      |                   ^~
a.cc:4:13: note: 'mp' declared here
    4 |   void (S::*mp)();
      |             ^~

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

* [Bug middle-end/101799] Warning messages for PMF leak internal names like ::__pfn and ::__delta
  2021-08-06  8:53 [Bug c++/101799] New: Warning messages for PMF leak internal names like ::__pfn and ::__delta slyfox at gcc dot gnu.org
@ 2021-08-06 16:55 ` msebor at gcc dot gnu.org
  2021-08-06 17:01 ` msebor at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-08-06 16:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
             Blocks|                            |24639
          Component|c++                         |middle-end
                 CC|                            |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1
           Keywords|                            |diagnostic
   Last reconfirmed|                            |2021-08-06

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The internal names are the ++ front end representation of member pointers as
seen in the dump below.  The pretty printer might be able to do a better job
formatting them (i.e., recognize it's a member pointer and print the name as it
appears in the source) but then we'd end up with a duplicate warning.  To avoid
that -Wuninitialized would also have to recognize member pointers and treat
them as special.  It might help to mark the internal names DECL_ARTIFICIAL.

bool f ()
{
  struct 
  {
    void S::<T36e> (struct S *) * __pfn;
    long int __delta;
  } mp;
  ...
  void S::<T36e> (struct S *) * _1;
  ...

  <bb 2> :
  # VUSE <.MEM_4(D)>
  _1 = mp.__pfn;   <<< -Wuninitialized


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639
[Bug 24639] [meta-bug] bug to track all Wuninitialized issues

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

* [Bug middle-end/101799] Warning messages for PMF leak internal names like ::__pfn and ::__delta
  2021-08-06  8:53 [Bug c++/101799] New: Warning messages for PMF leak internal names like ::__pfn and ::__delta slyfox at gcc dot gnu.org
  2021-08-06 16:55 ` [Bug middle-end/101799] " msebor at gcc dot gnu.org
@ 2021-08-06 17:01 ` msebor at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-08-06 17:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
PR 96989 is related only in that it also involves the pretty printer. 
Otherwise,  to avoid SSA_NAMEs the pretty-printer needs to recursively expand
them into their assignments from DECLs or expressions (e.g., results of
function calls etc.)

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

end of thread, other threads:[~2021-08-06 17:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06  8:53 [Bug c++/101799] New: Warning messages for PMF leak internal names like ::__pfn and ::__delta slyfox at gcc dot gnu.org
2021-08-06 16:55 ` [Bug middle-end/101799] " msebor at gcc dot gnu.org
2021-08-06 17:01 ` 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).