public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/41233] New: Templated conversion operator produces symbol name that won't demangle
@ 2009-09-03 0:21 zackw at panix dot com
2010-02-25 16:33 ` [Bug c++/41233] " jim at clkda dot com
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: zackw at panix dot com @ 2009-09-03 0:21 UTC (permalink / raw)
To: gcc-bugs
This program
class Source;
class Dest;
struct converter
{
converter(Source *s) {}
template<class D> operator D*();
};
Dest* f(Source* s) { return converter(s); }
when compiled by several different versions of g++ (I tried 4.3.4 and 4.4.1;
the person who asked me to reduce the test case found the problem on OSX with
some version of Apple-modified gcc 4.2), produces this symbol name for the
conversion operator:
_ZN9convertercvPT_I4DestEEv
c++filt from binutils 2.19 will not demangle this symbol. I have not been able
to figure out for certain whether this is an incorrect mangling, a demangler
bug, or both. These variations demangle to close approximations of the right
thing:
_ZN9convertercvT_IN4DestEEEv -> converter::operator Dest<Dest>()
_ZN9convertercvT_IPN4DestEEEv -> converter::operator Dest*<Dest*>()
but
_ZN9convertercvPT_IN4DestEEEv
does not demangle, either.
--
Summary: Templated conversion operator produces symbol name that
won't demangle
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: zackw at panix dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41233
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/41233] Templated conversion operator produces symbol name that won't demangle
2009-09-03 0:21 [Bug c++/41233] New: Templated conversion operator produces symbol name that won't demangle zackw at panix dot com
@ 2010-02-25 16:33 ` jim at clkda dot com
2010-02-25 16:35 ` jim at clkda dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: jim at clkda dot com @ 2010-02-25 16:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jim at clkda dot com 2010-02-25 16:33 -------
Created an attachment (id=19956)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19956&action=view)
Preprocessor output of code that produces a symbol that can't be demangled.
The symbol that can't be demangled is _ZNK3FooIPvEcvS_IT_EIiEEv, which should
correspond to
template <typename T>
template <typename U>
Foo<T>::operator Foo<U>() const;
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41233
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/41233] Templated conversion operator produces symbol name that won't demangle
2009-09-03 0:21 [Bug c++/41233] New: Templated conversion operator produces symbol name that won't demangle zackw at panix dot com
2010-02-25 16:33 ` [Bug c++/41233] " jim at clkda dot com
@ 2010-02-25 16:35 ` jim at clkda dot com
2010-02-25 20:02 ` jim at clkda dot com
2010-05-29 8:17 ` gcc at magfr dot user dot lysator dot liu dot se
3 siblings, 0 replies; 11+ messages in thread
From: jim at clkda dot com @ 2010-02-25 16:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jim at clkda dot com 2010-02-25 16:35 -------
I ran into this as well. My un-demanglable symbol is
_ZNK3FooIPvEcvS_IT_EIiEEv. Here's my info and attached test case is
demangle.ii:
/usr/bin/g++4 -v -save-temps -c -o demangle.o demangle.ccUsing built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --with-gxx-include-dir=/usr/include/c++/3.4.3
--enable-libgcj-multifile --enable-languages=c,c++,java,f95
--enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic
--host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)
/usr/libexec/gcc/x86_64-redhat-linux/4.1.2/cc1plus -E -quiet -v -D_GNU_SOURCE
demangle.cc -mtune=generic -fpch-preprocess -o demangle.ii
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/3.4.3
/usr/include/c++/3.4.3/x86_64-redhat-linux
/usr/include/c++/3.4.3/backward
/usr/local/include
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include
/usr/include
End of search list.
/usr/libexec/gcc/x86_64-redhat-linux/4.1.2/cc1plus -fpreprocessed demangle.ii
-quiet -dumpbase demangle.cc -mtune=generic -auxbase-strip demangle.o -version
-o demangle.s
GNU C++ version 4.1.2 20070626 (Red Hat 4.1.2-14) (x86_64-redhat-linux)
compiled by GNU C version 4.1.2 20070626 (Red Hat 4.1.2-14).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 184adf145435f56fdcc7b1a1fb1af981
as -V -Qy -o demangle.o demangle.s
GNU assembler version 2.15.92.0.2 (x86_64-redhat-linux) using BFD version
2.15.92.0.2 20040927
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41233
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/41233] Templated conversion operator produces symbol name that won't demangle
2009-09-03 0:21 [Bug c++/41233] New: Templated conversion operator produces symbol name that won't demangle zackw at panix dot com
2010-02-25 16:33 ` [Bug c++/41233] " jim at clkda dot com
2010-02-25 16:35 ` jim at clkda dot com
@ 2010-02-25 20:02 ` jim at clkda dot com
2010-05-29 8:17 ` gcc at magfr dot user dot lysator dot liu dot se
3 siblings, 0 replies; 11+ messages in thread
From: jim at clkda dot com @ 2010-02-25 20:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jim at clkda dot com 2010-02-25 20:01 -------
I think the T_ is not handling the forward reference to the not-yet-specified
first template parameter correctly. For the original example, replacing T_
with N4DestE gives something that *looks* right although is probably not
correct:
_ZN9convertercvPN4DestEI4DestEEv
which demangles to converter::operator Dest*<Dest>().
Similarly, in the second example, if I replace T_ with i, I get
_ZNK3FooIPvEcvS_IiEIiEEv
which demangles to Foo<void*>::operator Foo<int><int>() const.
http://www.codesourcery.com/public/cxx-abi/abi.html#mangling is helpful.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41233
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/41233] Templated conversion operator produces symbol name that won't demangle
2009-09-03 0:21 [Bug c++/41233] New: Templated conversion operator produces symbol name that won't demangle zackw at panix dot com
` (2 preceding siblings ...)
2010-02-25 20:02 ` jim at clkda dot com
@ 2010-05-29 8:17 ` gcc at magfr dot user dot lysator dot liu dot se
3 siblings, 0 replies; 11+ messages in thread
From: gcc at magfr dot user dot lysator dot liu dot se @ 2010-05-29 8:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from gcc at magfr dot user dot lysator dot liu dot se 2010-05-29 08:17 -------
I have run head-first into this problem as well.
I have found that _ZN1tcvT_IiEEv ( t::operator int<int>() ) works but
_ZN1tcvKT_IiEEv ( t::operator int const<int>() ) fails so it seems the problem
is that the template isn't detected, and looking at the code in
libiberty/cp-demangle.c (r159908) we have line 4689 that tries to detect if the
cast target is a template type but only handles the case where the type is
unadorned by anything and then there is the comment on lines 4696-4699 that
explains the problem.
--
gcc at magfr dot user dot lysator dot liu dot se changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gcc at magfr dot user dot
| |lysator dot liu dot se
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41233
^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <bug-41233-4@http.gcc.gnu.org/bugzilla/>]
end of thread, other threads:[~2022-11-20 20:17 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-03 0:21 [Bug c++/41233] New: Templated conversion operator produces symbol name that won't demangle zackw at panix dot com
2010-02-25 16:33 ` [Bug c++/41233] " jim at clkda dot com
2010-02-25 16:35 ` jim at clkda dot com
2010-02-25 20:02 ` jim at clkda dot com
2010-05-29 8:17 ` gcc at magfr dot user dot lysator dot liu dot se
[not found] <bug-41233-4@http.gcc.gnu.org/bugzilla/>
2012-01-06 18:01 ` jason at gcc dot gnu.org
2012-01-20 5:22 ` jason at gcc dot gnu.org
2012-01-20 10:41 ` paolo.carlini at oracle dot com
2012-11-26 10:24 ` glisse at gcc dot gnu.org
2022-11-20 19:40 ` pinskia at gcc dot gnu.org
2022-11-20 20:17 ` zack+srcbugz at owlfolio dot 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).