[Issue 17304] New: [SPEC] Anonymous symbols, show or ignore in demangler?

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Apr 7 16:36:41 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17304

          Issue ID: 17304
           Summary: [SPEC] Anonymous symbols, show or ignore in demangler?
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ibuclaw at gdcproject.org

Reduced-ish test:
---
template map(fun...) if (fun.length >= 1)
{
    auto map(Range)(Range r)
    {
        return r;
    }
}

unittest
{
    import std.algorithm.mutation, std.string;
    auto foo(string[] args)
    {
        return args.map!strip;
    }
}
---

Emits the function:

_D9iteration29__T3mapS189iteration005stripZ13__T3mapTAAyaZ3mapFNaNbNiNfAAyaZAAya

Which falls under the following rule twice in the mangling ABI:

SymbolName:
    0             // anonymous symbols


Current behaviour when the GNU binutils D demangler sees the 005, by mostly
fluke, strtol() returns the number 5, which means the two anonymous symbols are
skipped.

This seems to also be the case in the compiler also, as it doesn't should the
internal symbol when compiling with `-v'.

However, should this be assumed the correct way to handle this symbol?  If so
I'll make it explicit.

Otherwise the alternative would be to demangle the symbol as
`iteration.__anonymous.__anonymous.strip'.

--


More information about the Digitalmars-d-bugs mailing list