www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12423] New: extern(Windows) interfaces with -m64 broken

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12423

           Summary: extern(Windows) interfaces with -m64 broken
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: johnch_atms hotmail.com


--- Comment #0 from John Chapman <johnch_atms hotmail.com> 2014-03-20 03:58:17
PDT ---
The following program when compiled on x64 Windows with -m64 will cause a stack
overflow at runtime:

extern(Windows):

interface Base {
  void test();
}

class Derived : Base {
  void test() {}
}

extern(D):

void main() {
  Base b = new Derived();
  b.test();
}

Changing "extern(Windows)" to "extern(C++)" or "extern(D)" makes the program
run without problems.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 20 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12423


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2014-03-20
11:00:49 PDT ---
Confirmed with 2.065 and 2.066 git-head, Win7 x64.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 20 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12423


Benjamin Thaut <code benjamin-thaut.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code benjamin-thaut.de


--- Comment #2 from Benjamin Thaut <code benjamin-thaut.de> 2014-03-28 01:17:46
PDT ---
I also run into this issue. It seems that the function gets executed with the a
this pointer pointing to the interface instead of a this pointer pointing to
the actual class instance. So it seems that the trampoline inside the
interfaces vtbl does apply a incorrect offset.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 28 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12423


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |yebblies gmail.com


--- Comment #3 from yebblies <yebblies gmail.com> 2014-03-30 17:25:27 EST ---
I'm surprised it works as well as it does.

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