This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/22017] Error to pass struct parameter when compile with mingw's gcc.exe using "-march=i386 -mrtd" flags
- From: "dannysmith at users dot sourceforge dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Jun 2005 05:18:55 -0000
- Subject: [Bug target/22017] Error to pass struct parameter when compile with mingw's gcc.exe using "-march=i386 -mrtd" flags
- References: <20050611144331.22017.lyuzhou@21cn.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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