Bug 12423 – extern(Windows) interfaces with -m64 broken
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2014-03-20T03:58:00Z
Last change time
2015-05-15T09:27:53Z
Keywords
wrong-code
Assigned to
nobody
Creator
johnch_atms
Comments
Comment #0 by johnch_atms — 2014-03-20T03:58:17Z
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.
Comment #1 by andrej.mitrovich — 2014-03-20T11:00:49Z
Confirmed with 2.065 and 2.066 git-head, Win7 x64.
Comment #2 by code — 2014-03-28T01:17:46Z
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.