This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug other/16240] [3.4/3.5 Regression] Seg Fault in collect2 (caused by C++ demangling)


------- Additional Comments From ian at wasabisystems dot com  2004-06-28 15:37 -------
I fixed the bug in the demangler which was causing it to dump core.  However,
that reveals a bug in the mangled name which g++ is generating.

Skipping the analysis of the whole name, here is the end:
    LZNS_16complement_namesEELZNS_14COMPLEMENTENUMEEEE
'L' means a template argument.
'Z' means a local name
'NS_16complement_namesE' is a nested name (PatternDriver::complement_names)
'E' starts the entity name of the local name

At this point we expect to see the name of a variable within the
PatternDriver::complement_names class.  Instead, we see another template
argument.  That is wrong.

The bug is in write_template_arg(), in the DECL_P case.  It has been there for a
long time.  I suspect that the correct patch is:

diff -p -u -r1.101 mangle.c
--- mangle.c	1 Apr 2004 03:50:39 -0000	1.101
+++ mangle.c	28 Jun 2004 15:36:01 -0000
@@ -2208,6 +2208,7 @@ write_template_arg (tree node)
       if (code == CONST_DECL)
 	G.need_abi_warning = 1;
       write_char ('L');
+      write_char ('_');
       write_char ('Z');
       write_encoding (node);
       write_char ('E');

Unfortunately, that would be an ABI change.

I don't see how to correctly demangle this symbol.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ian at wasabisystems dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16240


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]