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 c++/70182] New: c++filt fails to demangle _ZNSt17_Function_handlerIFSt4pairImjEjEZN5folly12addBenchmarkI3$_0EENSt9enable_ifIXeqsr5boost14function_types14function_arityIDTadsrT_onclEEE5valueLi2EEvE4typeEPKcSC_OS7_EUljE_E9_M_invokeERKSt9_Any_dataj


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

            Bug ID: 70182
           Summary: c++filt fails to demangle
                    _ZNSt17_Function_handlerIFSt4pairImjEjEZN5folly12addBe
                    nchmarkI3$_0EENSt9enable_ifIXeqsr5boost14function_type
                    s14function_arityIDTadsrT_onclEEE5valueLi2EEvE4typeEPK
                    cSC_OS7_EUljE_E9_M_invokeERKSt9_Any_dataj
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: twoh at fb dot com
  Target Milestone: ---

c++filt cannot demangle
_ZNSt17_Function_handlerIFSt4pairImjEjEZN5folly12addBenchmarkI3$_0EENSt9enable_ifIXeqsr5boost14function_types14function_arityIDTadsrT_onclEEE5valueLi2EEvE4typeEPKcSC_OS7_EUljE_E9_M_invokeERKSt9_Any_dataj

The demangler fails when it encounters expression "srT_onclE". The reason is
that it applies a wrong rule to demangle expression. Comments in line 3095 of
libiberty/cp-demangle.c (2.26 release) says 

<expression> ::= sr <type> <unqualified-name>

is the rule, and this is implemented in line 3110-3124. However, if you see
Itanium C++
ABI(http://mentorembedded.github.io/cxx-abi/abi.html#mangle.expression), the
actual rule is

<expression> ::= sr <type> <base-unresolved-name>

and 'base-unresolved-name' has different rules with 'unqualified-name'.

Below is the source code that generates the name:

typename std::enable_if<
  boost::function_types::function_arity<decltype(&Lambda::operator())>::value
  == 2
>::type
addBenchmark(const char* file, const char* name, Lambda&& lambda) {
  auto execute = [=](unsigned int times) {
    unsigned int niter;
    niter = lambda(times);
    return detail::TimeIterPair(niter, 0);
  };

  detail::addBenchmarkImpl(file, name,
    std::function<detail::TimeIterPair(unsigned int)>(execute));
}

The symbol is generated from clang-3.7.1 compiler.

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