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

dannysmith at users dot sourceforge dot net gcc-bugzilla@gcc.gnu.org
Sun Jun 12 05:18:00 GMT 2005


------- 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



More information about the Gcc-bugs mailing list