Bug 465292 - G++ variadic templates not demangled
G++ variadic templates not demangled
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: binutils (Show other bugs)
rawhide
All Linux
medium Severity low
: ---
: ---
Assigned To: Jan Kratochvil
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-02 12:25 EDT by Jan Kratochvil
Modified: 2008-10-07 19:09 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-10-07 19:09:00 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
GNU Compiler Collection 37718 None None None Never

  None (edit)
Description Jan Kratochvil 2008-10-02 12:25:37 EDT
There seems to be a problem with the demangler in F9 when the new
variadic template feature of g++ is used.  Compile the code below and
you'll find this:

0000000000400596 W int f<double, int>(double, int __variadic)
0000000000400584 W _Z1fIiEiT_U10__variadicT0_
00000000004005d0 W int f<int, double, int>(int, double __variadic)

The second line should also be demangled.  No idea what it is but my
guess is no _Z* symbol should be left.

int f()
{
  return 0;
}

template <typename T, typename... U>
int f(T t, U... u)
{
  return (t ? 1 : 0) * sizeof...(U) + f(u...);
}

int
main()
{
  return f(1, 1.0, 2);
}
Comment 1 Jan Kratochvil 2008-10-07 19:09:00 EDT
Got fixed upstream:
http://gcc.gnu.org/ml/gcc-patches/2008-09/msg00729.html
http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00189.html

GCC now even produces different mangled names:
GNU C++ (GCC) version 4.4.0 20081007 (experimental) (x86_64-unknown-linux-gnu)
	compiled by GNU C version 4.4.0 20081007 (experimental), GMP version 4.2.2, MPFR version 2.3.1.

00000000004005c3 w F .text 000000000000003f _Z1fIdIiEEiT_DpT0_
0000000000400602 w F .text 0000000000000012 _Z1fIiIEEiT_DpT0_ 
0000000000400584 w F .text 000000000000003f _Z1fIiIdiEEiT_DpT0_

00000000004005c3 w F .text 000000000000003f int f<double, int>(double, int) 
0000000000400602 w F .text 0000000000000012 int f<int, >(int, )
0000000000400584 w F .text 000000000000003f int f<int, double, int>(int, double, int)

2008-09-09  Jason Merrill  <jason@redhat.com>

	* include/demangle.h (enum demangle_component_type): Add
	DEMANGLE_COMPONENT_DECLTYPE.
	* libiberty/cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_DECLTYPE.
	(d_make_comp): Likewise.
	(cplus_demangle_type): Handle decltype and DFP types.
	(cplus_demangle_operators): Call operator takes 2 args.
	(cplus_demangle_builtin_types): Add DFP types.
	(d_exprlist): New fn.
	(d_expression): Handle parm placeholders, T() and calls.
	(d_print_comp): Handle decltype, T() and calls.
	* libiberty/testsuite/demangle-expected: Test the above.

2008-10-06  Jason Merrill  <jason@redhat.com>

gcc/cp/:
	PR c++/37376, other mangling issues
	* mangle.c (write_type): Update TYPE_PACK_EXPANSION mangling.
	(write_member_name): Break out from...
	(write_expression): ...here.  Handle dependent COMPONENT_REF.
	(write_template_arg): Wrap an argument pack in 'I'/'E'.
	(write_builtin_type): Update char16/32_t mangling.
	(write_nested_name, write_prefix): Don't forget template args
	for typename types.
	* operators.def: Add ARROW_EXPR, update COMPONENT_REF and 
	EXPR_PACK_EXPANSION.
libstdc++-v3/:
	* config/abi/pre/gnu.ver: Update char16/32_t manglings.
include/:
	* demangle.h (enum demangle_component_type): Add
	DEMANGLE_COMPONENT_PACK_EXPANSION.
libiberty/:
	* cp-demangle.c (struct d_print_info): Add pack_index.
	(d_dump): Add DEMANGLE_COMPONENT_PACK_EXPANSION.
	(d_make_comp): Likewise.  DEMANGLE_COMPONENT_ARGLIST and
	DEMANGLE_COMPONENT_TEMPLATE_ARGLIST can have two null args.
	(cplus_demangle_builtin_types): Add char16/32_t.
	(cplus_demangle_type): Recognize them.
	(d_template_args): Handle empty argument packs.
	(d_template_arg): Handle argument packs.
	(d_expression): Handle dependent name.
	(d_index_template_argument): New fn.
	(d_lookup_template_argument): New fn.
	(d_find_pack, d_pack_length): New fn.
	(d_print_subexpr): Split out...
	(d_print_comp): ...from here.  Use d_*_template_argument.
	Handle empty arg lists.  Support pack expansions.
	* cp-demangle.h (D_BUILTIN_TYPE_COUNT): Increase to 32.

  2008-09-09  Jason Merrill  <jason@redhat.com>
  
  	* cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_DECLTYPE.

Note You need to log in before you can comment on or make changes to this bug.