http://d.puremagic.com/issues/show_bug.cgi?id=4323

           Summary: std.demangle incorrectly handles template floating
                    point numbers
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nob...@puremagic.com
        ReportedBy: d...@me.com


--- Comment #0 from Jacob Carlborg <d...@me.com> 2010-06-15 11:38:04 PDT ---
According to the ABI spec the mangled form of template floating point numbers
looks like this:

Value:
    e HexFloat

HexFloat:
    N HexDigits P Exponent
    HexDigits P Exponent

But std.demnalge doesn't seem to handle the exponent, it doesn't handle the
'P'. The unittests that test this are also incorrect. The first one looks like
this:

mangled form:
_D4test58__T9factorialVde67666666666666860140VG5aa5_68656c6c6fVPvnZ9factorialf

demangled form:
float test.factorial!(double 4.2, char[5] \"hello\"c, void* null).factorial

As far as I can see the mangled form doesn't follow the spec or what dmd
produces.

module test;

float factorial (T...) ()
{
    return float.init;
}

void main ()
{
    factorial!(4.2, "hello", null);
}

Compiling the above code and running the "nm" command on the resulting binary
shows that "factorial" with the above given values is mangled as:
_D4test57__T9factorialVde8666666666666667PN1VAyaa5_68656c6c6fVPvnZ9factorialFZf

After all the 6s the is a 7 and then a P. In the std.demangle unittest the P is
missing, also at the end of the mangled name is a Z which is missing in the
unittest.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to