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]

[Bug target/22017] Error to pass struct parameter when compile with mingw's gcc.exe using "-march=i386 -mrtd" flags


------- Additional Comments From dannysmith at users dot sourceforge dot net  2005-06-12 05:18 -------
Hi,

I think the problem is that 

    st.m_i = 1;
    st.m_ch[0] = 0;

causes gcc to generate a call to the library memcpy.  Since the -mrtd switch is 
in effect, the call is generated assuming that memcpy will pop the stack.  It 
doesn't, of course, so the stack is corrupted.

Adding a static extern "C" memcpy code to the testcase, so that the local 
memcpy does indeed use rtd convention,  make the assert succeed.

Danny

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22017


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