Bug 27636 - Bad thunk alias to stdcall method
Summary: Bad thunk alias to stdcall method
Status: RESOLVED DUPLICATE of bug 27067
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on: 27067
Blocks:
  Show dependency treegraph
 
Reported: 2006-05-16 23:13 UTC by Ross Ridge
Modified: 2006-05-17 02:36 UTC (History)
3 users (show)

See Also:
Host: i386-pc-mingw32
Target: i386-pc-mingw32
Build: i386-pc-mingw32
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Ridge 2006-05-16 23:13:45 UTC
Compiling the following program:

#define STDCALL __attribute__((stdcall))

struct  B1 {
	int x;
	virtual int STDCALL bar(int x) = 0;
};

struct  B2 {
	int x;
	virtual int STDCALL foo(int x) = 0;
};

struct D: B1, B2 {
	int a;
	int STDCALL bar(int n);
	int STDCALL foo(int n);
};

int STDCALL
D::bar(int n) {
	return a + n;
}

int STDCALL
D::foo(int n) {
	return a + n;
}

with "gcc -x c++ gccbug5.c" on MinGW results in the following error message:

gccbug5.c:26: error: 'int *LTHUNK0(int)' aliased to undefined symbol '_ZN1D3fooEi'
Comment 1 Ross Ridge 2006-05-16 23:38:44 UTC
LTHUNK0 should be aliased to "_ZN1D3fooEi@4".

The bug goes away if D::bar(int) is not defined.
Comment 2 Andrew Pinski 2006-05-16 23:54:27 UTC
This looks related to Bug 27067.
Comment 3 Andrew Pinski 2006-05-16 23:55:01 UTC
Does the patch there fix this issue also?
Comment 4 Wlodek Szafran 2006-05-17 01:15:30 UTC
(In reply to comment #2)
> This looks related to Bug 27067.

Not only related but pretty much the same thing.  And Ross' example program compiles cleanly using the latest 4.1.1 (20060512) snapshot with Danny's patch for 27067 applied.  I don't have the 4.2.0 available but I imagine the same patch can be used to mend it as well.
Comment 5 Andrew Pinski 2006-05-17 02:36:13 UTC

*** This bug has been marked as a duplicate of 27067 ***