#33 __stdcall for inline method definition

closed-fixed
nobody
gcc (462)
2002-05-26
2001-04-09
TAMURA Kent
No

Environment:
gcc-2.95.2-3
Windows 2000

__stdcall is ignored if it is attached to inline
definition of a method. For example:

------------------------------------------------
int bar();

class FooClass {
public:
virtual int __stdcall QueryInterfaceI(const void*,
void**) {
return bar();
}
virtual int __stdcall QueryInterface(const void*,
void**);
};

int FooClass::QueryInterface(const void*, void**) {
return bar();
}
-------------------------------------------------

I compiled this source with "gcc.exe -O2 -S
inline.cpp".
Compiled code for FooClass::QueryInterfaceI() was:

-------------------------------------
_QueryInterfaceI__8FooClassPCvPPv:
pushl %ebp
movl %esp,%ebp
subl $8,%esp
call _bar__Fv
leave
ret
-------------------------------------
The "ret" at the last line must be "ret $12"
because QueryInterfaceI() is __stdcall.

Discussion

  • Danny Smith
    Danny Smith
    2001-04-09

    Logged In: YES
    user_id=11494

    Compiles correctly with gcc-2.95.3 with Bob Wilson's patch.
    Refer #414799

     
  • TAMURA Kent
    TAMURA Kent
    2001-04-10

    Logged In: YES
    user_id=163353

    I built a FSF gcc-2.95.3 with Bob Wilson's patch (without
    mingw patches) and compiled the code above. But the gcc
    still generated a wrong code. I inserted printf() at
    patched blocks in the cp/decl.c. gcc didn't print nothing.

    Do I need other patches?

    --
    TAMURA Kent

     
  • TAMURA Kent
    TAMURA Kent
    2001-04-10

    Logged In: YES
    user_id=163353

    Oops, "gcc didn't print nothing" -> "gcc printed nothing"

     
  • Danny Smith
    Danny Smith
    2001-04-10

    Logged In: YES
    user_id=11494

    I shouldn't have said nothing ;{ about that bug
    I was wrong about the bug being fixed -- I was looking at
    assembly for the non-inline method. Bob Wilson's patch
    does't touch this one becuase of the inline attribute.
    Danny

     
  • Danny Smith
    Danny Smith
    2001-04-11

    Logged In: YES
    user_id=11494

    Hold on moment. Isn't the whole point of inlining to
    integrate calls to the function into the caller? If so
    isn't the calling convention irrelevant? What am I missing?
    Danny

     
  • TAMURA Kent
    TAMURA Kent
    2001-04-13

    Logged In: YES
    user_id=163353

    That is not related to function inlining.
    Probably "on-the-spot definition" was more suitable words
    than "inline definition" in this case.

    I have found this problem was reported to FSF's gnatsweb.
    http://gcc.gnu.org/cgi-bin/gnatsweb.pl?
    cmd=view&pr=907&database=gcc

     
  • Luke Dunstan
    Luke Dunstan
    2002-05-22

    Logged In: YES
    user_id=30442

    PR 907 has been closed and this bug is fixed in GCC 3.1.

     
  • Danny Smith
    Danny Smith
    2002-05-26

    • status: open --> closed-fixed