This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bugs with __stdcall


excuse me for my english.

I'm used - gcc version 3.2 (mingw special 20020817-1), system - Windows 98

example:

name file - pr.cpp
--------------------------------------
        __stdcall int func( int a, int b )
        {
         return a + b;
        }

        int main()
        {
         func( 1, 2 );
         return 0;
        }
---------------------------------------
compiled: gcc -Os -S -mregparm=3 pr.cpp

view pr.s
......
             .def __Z4funcii@8; .scl 2; .type 32; .endef
__Z4funcii@8:
LFB1:
             pushl %ebp
LCFI0:
             addl %edx, %eax
             movl %esp, %ebp
LCFI1:
             popl %ebp
             ret
LFE1:
             .def ___main; .scl 2; .type 32; .endef
             .align 2
            .globl _main
             .def _main; .scl 2; .type 32; .endef
 _main:
LFB2:
             pushl %ebp
LCFI2:
             movl %esp, %ebp
LCFI3:
             call ___main
             movl $1, %eax        ; WHY? Function is attribute __stdcall!
Parameters must push on stack!
             movl $2, %edx        ;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
             call __Z4funcii@8
             popl %ebp
             xorl %eax, %eax
             ret
LFE2:
........................

if compiled without -mrefparm=3, then parameters is push on stack

Igor Ranuk.
city: Kherson, country: Ukrain



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]