public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug demangler/96143] New: C++ demangler should not add a lambda as a substitution
@ 2020-07-10  4:27 ian at airs dot com
  2020-07-10 12:41 ` [Bug demangler/96143] " nathan at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ian at airs dot com @ 2020-07-10  4:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96143
           Summary: C++ demangler should not add a lambda as a
                    substitution
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: demangler
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ian at airs dot com
  Target Milestone: ---

The C++ demangler adds a lambda as a substitution in d_lambda in
libiberty/cp-demangle.c.  However, the C++ compiler does not add a lambda as a
substitution in write_closure_type_name in cp/mangle.c.  According to
https://codesourcery.com/cxx-abi, the compiler is correct and the demangler is
not.

Here is a test case that shows the problem:

template<typename F>
struct A {
  typedef int X;
};

template<typename F>
inline typename A<F>::X
F2(F f) {
  return 0;
}

void F() {
  F2([]{});
}

This produces the symbol _Z2F2IZ1FvEUlvE_EN1AIT_E1XES2_, which is the type of
F2 instantiated with a lambda.  Currently the demangler demangles this as

A<F()::{lambda()#1}>::X F2<F()::{lambda()#1}>(A)

Note the final (A).  That does not make sense.  The argument type of F2 is not
A, which doesn't even make sense by itself.  The argument type is a lambda.

Compare to the output of llvm-cxxfilt:

A<F()::'lambda'()>::X F2<F()::'lambda'()>(F()::'lambda'())

Here the argument is correctly shown as a lambda.

I can send a patch.

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

* [Bug demangler/96143] C++ demangler should not add a lambda as a substitution
  2020-07-10  4:27 [Bug demangler/96143] New: C++ demangler should not add a lambda as a substitution ian at airs dot com
@ 2020-07-10 12:41 ` nathan at gcc dot gnu.org
  2020-07-14 17:27 ` cvs-commit at gcc dot gnu.org
  2020-07-14 17:36 ` ian at airs dot com
  2 siblings, 0 replies; 4+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-07-10 12:41 UTC (permalink / raw)
  To: gcc-bugs

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

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-07-10
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
Thanks for the reminder.  If you do indeed have a patch, you know what to do :)

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

* [Bug demangler/96143] C++ demangler should not add a lambda as a substitution
  2020-07-10  4:27 [Bug demangler/96143] New: C++ demangler should not add a lambda as a substitution ian at airs dot com
  2020-07-10 12:41 ` [Bug demangler/96143] " nathan at gcc dot gnu.org
@ 2020-07-14 17:27 ` cvs-commit at gcc dot gnu.org
  2020-07-14 17:36 ` ian at airs dot com
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-14 17:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Ian Lance Taylor <ian@gcc.gnu.org>:

https://gcc.gnu.org/g:bae45b8be57b2a2c22bf45f3eeb1118c328ad028

commit r11-2093-gbae45b8be57b2a2c22bf45f3eeb1118c328ad028
Author: Ian Lance Taylor <iant@golang.org>
Date:   Fri Jul 10 09:34:28 2020 -0700

    demangler: don't treat lambda as a substitution candidate

    libiberty/ChangeLog:

            PR demangler/96143
            * cp-demangle.c (d_lambda): Don't add substitution candidate.
            * testsuite/demangle-expected: Update a few existing test cases
            accordingly, and add a new test case.

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

* [Bug demangler/96143] C++ demangler should not add a lambda as a substitution
  2020-07-10  4:27 [Bug demangler/96143] New: C++ demangler should not add a lambda as a substitution ian at airs dot com
  2020-07-10 12:41 ` [Bug demangler/96143] " nathan at gcc dot gnu.org
  2020-07-14 17:27 ` cvs-commit at gcc dot gnu.org
@ 2020-07-14 17:36 ` ian at airs dot com
  2 siblings, 0 replies; 4+ messages in thread
From: ian at airs dot com @ 2020-07-14 17:36 UTC (permalink / raw)
  To: gcc-bugs

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

Ian Lance Taylor <ian at airs dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Ian Lance Taylor <ian at airs dot com> ---
Fixed on trunk.

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

end of thread, other threads:[~2020-07-14 17:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-10  4:27 [Bug demangler/96143] New: C++ demangler should not add a lambda as a substitution ian at airs dot com
2020-07-10 12:41 ` [Bug demangler/96143] " nathan at gcc dot gnu.org
2020-07-14 17:27 ` cvs-commit at gcc dot gnu.org
2020-07-14 17:36 ` ian at airs dot com

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).