public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54895] New: the compiler treats '__cdecl' & '__stdcall' as the same.
@ 2012-10-10 19:52 i.nixman at gmail dot com
2012-10-10 19:54 ` [Bug c++/54895] " i.nixman at gmail dot com
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: i.nixman at gmail dot com @ 2012-10-10 19:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54895
Bug #: 54895
Summary: the compiler treats '__cdecl' & '__stdcall' as the
same.
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: i.nixman@gmail.com
When I compile this simple code:
void myfoo(void(__cdecl*)()){}
void myfoo(void(__stdcall*)()){}
int main(){}
I get the following error:
Assembler messages:
Error: symbol `__Z5myfooPFvvE' is already defined
Why the compiler treats theese two specificators as the same?
Another example code work as expected:
template<typename T, typename U>
struct is_same {
enum { value = 0 };
};
template<typename T>
struct is_same<T, T> {
enum { value = 1 };
};
int main() {
typedef void(__stdcall* stdcall_func_ptr)();
typedef void(__cdecl* cdecl_func_ptr)();
return is_same<stdcall_func_ptr, cdecl_func_ptr>::value;
}
main returns 0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/54895] the compiler treats '__cdecl' & '__stdcall' as the same.
2012-10-10 19:52 [Bug c++/54895] New: the compiler treats '__cdecl' & '__stdcall' as the same i.nixman at gmail dot com
@ 2012-10-10 19:54 ` i.nixman at gmail dot com
2012-10-10 20:17 ` sezeroz at gmail dot com
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: i.nixman at gmail dot com @ 2012-10-10 19:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54895
--- Comment #1 from niXman <i.nixman at gmail dot com> 2012-10-10 19:53:48 UTC ---
used i686-w64-mingw32
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/54895] the compiler treats '__cdecl' & '__stdcall' as the same.
2012-10-10 19:52 [Bug c++/54895] New: the compiler treats '__cdecl' & '__stdcall' as the same i.nixman at gmail dot com
2012-10-10 19:54 ` [Bug c++/54895] " i.nixman at gmail dot com
@ 2012-10-10 20:17 ` sezeroz at gmail dot com
2012-10-10 20:53 ` [Bug target/54895] " glisse at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: sezeroz at gmail dot com @ 2012-10-10 20:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54895
Ozkan Sezer <sezeroz at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sezeroz at gmail dot com
--- Comment #2 from Ozkan Sezer <sezeroz at gmail dot com> 2012-10-10 20:17:26 UTC ---
FWIW, this is not specific to 4.7 and goes back to at least 4.4.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/54895] the compiler treats '__cdecl' & '__stdcall' as the same.
2012-10-10 19:52 [Bug c++/54895] New: the compiler treats '__cdecl' & '__stdcall' as the same i.nixman at gmail dot com
2012-10-10 19:54 ` [Bug c++/54895] " i.nixman at gmail dot com
2012-10-10 20:17 ` sezeroz at gmail dot com
@ 2012-10-10 20:53 ` glisse at gcc dot gnu.org
2012-11-22 11:47 ` ktietz at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: glisse at gcc dot gnu.org @ 2012-10-10 20:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54895
--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> 2012-10-10 20:52:38 UTC ---
Related to PR c++/2316. Those attributes are properly supported in C but not
with fancy C++ features. I don't think they have a mangling, for instance.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/54895] the compiler treats '__cdecl' & '__stdcall' as the same.
2012-10-10 19:52 [Bug c++/54895] New: the compiler treats '__cdecl' & '__stdcall' as the same i.nixman at gmail dot com
` (2 preceding siblings ...)
2012-10-10 20:53 ` [Bug target/54895] " glisse at gcc dot gnu.org
@ 2012-11-22 11:47 ` ktietz at gcc dot gnu.org
2012-11-22 18:38 ` i.nixman at gmail dot com
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ktietz at gcc dot gnu.org @ 2012-11-22 11:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54895
Kai Tietz <ktietz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ktietz at gcc dot gnu.org
--- Comment #4 from Kai Tietz <ktietz at gcc dot gnu.org> 2012-11-22 11:47:12 UTC ---
This is most likely a duplicate of already fixed PR/55268.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/54895] the compiler treats '__cdecl' & '__stdcall' as the same.
2012-10-10 19:52 [Bug c++/54895] New: the compiler treats '__cdecl' & '__stdcall' as the same i.nixman at gmail dot com
` (3 preceding siblings ...)
2012-11-22 11:47 ` ktietz at gcc dot gnu.org
@ 2012-11-22 18:38 ` i.nixman at gmail dot com
2012-11-22 18:48 ` ktietz at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: i.nixman at gmail dot com @ 2012-11-22 18:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54895
--- Comment #5 from niXman <i.nixman at gmail dot com> 2012-11-22 18:37:55 UTC ---
(In reply to comment #4)
> This is most likely a duplicate of already fixed PR/55268.
I checked upon the 193725 revision.
The first test gives the same result. The second test now gives the wrong
result(1). Before this the result of the second test was right.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/54895] the compiler treats '__cdecl' & '__stdcall' as the same.
2012-10-10 19:52 [Bug c++/54895] New: the compiler treats '__cdecl' & '__stdcall' as the same i.nixman at gmail dot com
` (4 preceding siblings ...)
2012-11-22 18:38 ` i.nixman at gmail dot com
@ 2012-11-22 18:48 ` ktietz at gcc dot gnu.org
2012-11-22 18:55 ` [Bug c++/54895] " ktietz at gcc dot gnu.org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ktietz at gcc dot gnu.org @ 2012-11-22 18:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54895
Kai Tietz <ktietz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-11-22
Ever Confirmed|0 |1
--- Comment #6 from Kai Tietz <ktietz at gcc dot gnu.org> 2012-11-22 18:48:18 UTC ---
(In reply to comment #5)
> (In reply to comment #4)
> > This is most likely a duplicate of already fixed PR/55268.
>
> I checked upon the 193725 revision.
> The first test gives the same result. The second test now gives the wrong
> result(1). Before this the result of the second test was right.
Well, the first test fails due the calling-convention isn't part of the
signature in C++. For C you will get for this code simply a double-definition.
Issue here is that we don't get an error for g++ as it detects that a types
are different for both myfoo functions.
The second case checks something different. That it now returns 1 is correct
due types are different due different calling-convention used.
So remaining testcase is the first one.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/54895] the compiler treats '__cdecl' & '__stdcall' as the same.
2012-10-10 19:52 [Bug c++/54895] New: the compiler treats '__cdecl' & '__stdcall' as the same i.nixman at gmail dot com
` (5 preceding siblings ...)
2012-11-22 18:48 ` ktietz at gcc dot gnu.org
@ 2012-11-22 18:55 ` ktietz at gcc dot gnu.org
2012-11-22 19:08 ` paolo.carlini at oracle dot com
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ktietz at gcc dot gnu.org @ 2012-11-22 18:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54895
Kai Tietz <ktietz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|target |c++
Known to work| |4.4.0, 4.5.0, 4.6.0, 4.7.0,
| |4.8.0
--- Comment #7 from Kai Tietz <ktietz at gcc dot gnu.org> 2012-11-22 18:55:40 UTC ---
it is actual not a target issue. it is more a general c++ issue as
calling-convention (call-abi attributes) aren't part of signature.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/54895] the compiler treats '__cdecl' & '__stdcall' as the same.
2012-10-10 19:52 [Bug c++/54895] New: the compiler treats '__cdecl' & '__stdcall' as the same i.nixman at gmail dot com
` (6 preceding siblings ...)
2012-11-22 18:55 ` [Bug c++/54895] " ktietz at gcc dot gnu.org
@ 2012-11-22 19:08 ` paolo.carlini at oracle dot com
2012-11-22 19:11 ` ktietz at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-22 19:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54895
--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-22 19:08:14 UTC ---
So it works everywhere? ;)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/54895] the compiler treats '__cdecl' & '__stdcall' as the same.
2012-10-10 19:52 [Bug c++/54895] New: the compiler treats '__cdecl' & '__stdcall' as the same i.nixman at gmail dot com
` (7 preceding siblings ...)
2012-11-22 19:08 ` paolo.carlini at oracle dot com
@ 2012-11-22 19:11 ` ktietz at gcc dot gnu.org
2012-11-22 19:14 ` paolo.carlini at oracle dot com
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ktietz at gcc dot gnu.org @ 2012-11-22 19:11 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54895
--- Comment #9 from Kai Tietz <ktietz at gcc dot gnu.org> 2012-11-22 19:11:12 UTC ---
(In reply to comment #8)
> So it works everywhere? ;)
Well, it doesn't work for all targets providing different calling-conventions
for functions. Eg functions with regparm, stdcall, etc
That the sample is architecture specific, doesn't make it there for target
specific, isn't it? ;)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/54895] the compiler treats '__cdecl' & '__stdcall' as the same.
2012-10-10 19:52 [Bug c++/54895] New: the compiler treats '__cdecl' & '__stdcall' as the same i.nixman at gmail dot com
` (8 preceding siblings ...)
2012-11-22 19:11 ` ktietz at gcc dot gnu.org
@ 2012-11-22 19:14 ` paolo.carlini at oracle dot com
2012-11-22 19:16 ` ktietz at gcc dot gnu.org
2015-09-22 10:33 ` ktietz at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-22 19:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54895
--- Comment #10 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-22 19:14:03 UTC ---
I don't know, I'm still finding the "Known to work" field pretty weird, to be
honest.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/54895] the compiler treats '__cdecl' & '__stdcall' as the same.
2012-10-10 19:52 [Bug c++/54895] New: the compiler treats '__cdecl' & '__stdcall' as the same i.nixman at gmail dot com
` (9 preceding siblings ...)
2012-11-22 19:14 ` paolo.carlini at oracle dot com
@ 2012-11-22 19:16 ` ktietz at gcc dot gnu.org
2015-09-22 10:33 ` ktietz at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: ktietz at gcc dot gnu.org @ 2012-11-22 19:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54895
Kai Tietz <ktietz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work|4.4.0, 4.5.0, 4.6.0, 4.7.0, |
|4.8.0 |
Known to fail| |4.4.0, 4.5.0, 4.6.0, 4.7.0,
| |4.8.0
--- Comment #11 from Kai Tietz <ktietz at gcc dot gnu.org> 2012-11-22 19:15:49 UTC ---
heh, oh duhh :}
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/54895] the compiler treats '__cdecl' & '__stdcall' as the same.
2012-10-10 19:52 [Bug c++/54895] New: the compiler treats '__cdecl' & '__stdcall' as the same i.nixman at gmail dot com
` (10 preceding siblings ...)
2012-11-22 19:16 ` ktietz at gcc dot gnu.org
@ 2015-09-22 10:33 ` ktietz at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: ktietz at gcc dot gnu.org @ 2015-09-22 10:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54895
--- Comment #12 from Kai Tietz <ktietz at gcc dot gnu.org> ---
This bug got partially fixed for x86 (32-bit) by PR/44282. For x64 we have the
issue that there is made no difference between different calling-conventions,
as all variants are treated as standard fastcall-convention under the hood.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2015-09-22 10:33 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-10 19:52 [Bug c++/54895] New: the compiler treats '__cdecl' & '__stdcall' as the same i.nixman at gmail dot com
2012-10-10 19:54 ` [Bug c++/54895] " i.nixman at gmail dot com
2012-10-10 20:17 ` sezeroz at gmail dot com
2012-10-10 20:53 ` [Bug target/54895] " glisse at gcc dot gnu.org
2012-11-22 11:47 ` ktietz at gcc dot gnu.org
2012-11-22 18:38 ` i.nixman at gmail dot com
2012-11-22 18:48 ` ktietz at gcc dot gnu.org
2012-11-22 18:55 ` [Bug c++/54895] " ktietz at gcc dot gnu.org
2012-11-22 19:08 ` paolo.carlini at oracle dot com
2012-11-22 19:11 ` ktietz at gcc dot gnu.org
2012-11-22 19:14 ` paolo.carlini at oracle dot com
2012-11-22 19:16 ` ktietz at gcc dot gnu.org
2015-09-22 10:33 ` ktietz at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).