Thread overview
[Issue 5148] New: Incorrect C++ mangling of multiple const char* parameters
Nov 01, 2010
Jacob Carlborg
Nov 04, 2010
Lukasz Wrzosek
Nov 10, 2010
Walter Bright
Nov 11, 2010
Lukasz Wrzosek
Nov 12, 2010
Iain Buclaw
Nov 12, 2010
Iain Buclaw
Nov 12, 2010
Lukasz Wrzosek
Nov 19, 2010
Walter Bright
November 01, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5148

           Summary: Incorrect C++ mangling of multiple const char*
                    parameters
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: doob@me.com


--- Comment #0 from Jacob Carlborg <doob@me.com> 2010-11-01 07:35:25 PDT ---
DMD incorrectly mangles the following function:

extern (C++) void error (const char*, const char*) {}

DMD mangling: __Z5errorPKcS_
GCC mangling: __Z5errorPKcS0_

It has to be at least two parameters, not the first parameter and any of the other parameters have to be const char*.

I don't know if this is the same bug as 4059 but that one doesn't mention const. This is also a blocker for DDMD on Posix.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 04, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5148


Lukasz Wrzosek <luk.wrzosek@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |luk.wrzosek@gmail.com


--- Comment #1 from Lukasz Wrzosek <luk.wrzosek@gmail.com> 2010-11-03 22:03:52 PDT ---
See bug 4059 for patch.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 10, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5148


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2010-11-10 01:23:36 PST ---
The patch for 4059 does not work for this one.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 11, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5148



--- Comment #3 from Lukasz Wrzosek <luk.wrzosek@gmail.com> 2010-11-11 12:52:29 PST ---
Created an attachment (id=806)
Fix for bug 5148

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 12, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5148


Iain Buclaw <ibuclaw@ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw@ubuntu.com


--- Comment #4 from Iain Buclaw <ibuclaw@ubuntu.com> 2010-11-11 16:26:28 PST ---
That's not really a proper fix.

Yes, it works for this original example in this report, however it doesn't pass this test:

extern (C++) void bug5148a(char*,       char*,       char*,       char*);
extern (C++) void bug5148b(char*,       char*,       char*,       const char*);
extern (C++) void bug5148c(char*,       char*,       const char*, char*);
extern (C++) void bug5148d(char*,       char*,       const char*, const char*);
extern (C++) void bug5148e(char*,       const char*, char*,       char*);
extern (C++) void bug5148f(char*,       const char*, char*,       const char*);
extern (C++) void bug5148g(char*,       const char*, const char*, char*);
extern (C++) void bug5148h(char*,       const char*, const char*, const char*);
extern (C++) void bug5148i(const char*, char*,       char*,       char*);
extern (C++) void bug5148j(const char*, char*,       char*,       const char*);
extern (C++) void bug5148k(const char*, char*,       const char*, char*);
extern (C++) void bug5148l(const char*, char*,       const char*, const char*);
extern (C++) void bug5148m(const char*, const char*, char*,       char*);
extern (C++) void bug5148n(const char*, const char*, char*,       const char*);
extern (C++) void bug5148o(const char*, const char*, const char*, char*);
extern (C++) void bug5148p(const char*, const char*, const char*, const char*);


Regards

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 12, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5148



--- Comment #5 from Iain Buclaw <ibuclaw@ubuntu.com> 2010-11-12 00:30:29 PST ---
Apparently I didn't test it against the patch against the trunk last night. :~) It seems fine now I've rebuilt it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 12, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5148


Lukasz Wrzosek <luk.wrzosek@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #806 is|0                           |1
           obsolete|                            |


--- Comment #6 from Lukasz Wrzosek <luk.wrzosek@gmail.com> 2010-11-12 09:23:30 PST ---
Created an attachment (id=807)
Fix for bug 5148 and some other fixes.

This patch fixes also some other issues that I think weren't reported up to
now.
In gcc c++ functions with const arguments passed by value are mangled like not
const:
void Test(const int, const int) -> _Z4Testii
void Test(const char, const char) -> _Z4Testcc

struct MyStrutType { };
void Test(const MyStructType, const MyStructType) -> _Z4Test12MyStructTypeS_

enum MyEnumType { };
void Test(const MyEnumType, const MyEnumType) -> _Z4Test10MyEnumTypeS_

Without this patch dmd generates const versions.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 19, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5148


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #7 from Walter Bright <bugzilla@digitalmars.com> 2010-11-18 20:07:33 PST ---
http://www.dsource.org/projects/dmd/changeset/762

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