www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15014] New: Win64: Invalid C++ mangling for multiple long

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

          Issue ID: 15014
           Summary: Win64: Invalid C++ mangling for multiple long
                    arguments
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: r.sagitario gmx.de

Detected by the fuzzer and manually reduced:

// cppa.d
extern(C++) void fuzz1_cppvararg(long arg10, long arg11, bool arg12);
extern(C++) void fuzz1_dvararg(long arg10, long arg11, bool arg12)
{
    fuzz1_checkValues(arg10, arg11, arg12);
}

extern(C++) void fuzz1_checkValues(long arg10, long arg11, bool arg12)
{
    assert(arg10 == 103);
    assert(arg11 == 104);
    assert(arg12 == false);
}

void main()
{
    long arg10 = 103;
    long arg11 = 104;
    bool arg12 = false;
    fuzz1_dvararg(arg10, arg11, arg12);
    fuzz1_cppvararg(arg10, arg11, arg12);
}

// cppb.cpp
void fuzz1_checkValues(long long arg10, long long arg11, bool arg12);
void fuzz1_cppvararg(long long arg10, long long arg11, bool arg12)
{
    fuzz1_checkValues(arg10, arg11, arg12);
}

compile with 64-bit cl:
cl /c cppd.cpp
dmd -m64 cppa.d cppd.obj

cppa.obj : error LNK2019: unresolved external symbol "void __cdecl
fuzz1_cppvararg(__int64,__int64,bool)" (?fuzz1_cppvararg  YAX_J_J_N Z)
referenced in function _D4cppa5fuzz1FZv
cppb.obj : error LNK2019: unresolved external symbol "void __cdecl
fuzz1_checkValues(__int64,__int64,bool)" (?fuzz1_checkValues  YAX_J0_N Z)
referenced in function "void __cdecl fuzz1_cppvararg(__int64,__int64,bool)"
(?fuzz1_cppvararg  YAX_J0_N Z)

--
Sep 05 2015