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 09:40:03 -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 09:39 -------
Hi,
This is what is says in the comments above i386/i386.c:
ix86_return_pop_args:
FUNDECL is the declaration node of the function (as a tree),
FUNTYPE is the data type of the function (as a tree),
or for a library call it is an identifier node for the subroutine name.
and indeed , the call to build_decl in init_block_move_fn in expr.c
(where the call to "mmecpy" is generated) has an identifier node as the
second arg.
There appears to be a long-standing thinko in the test for library calls
in ix86_return_pops_args.
This patch fixes the memcpy call in the testcase on trunk. I'll do a
bootstrap and regetest overnight. Could you test on 3.4 branch please.
* config/i386/i386 (ix86_return_pops_args): Test the function
type, not the decl node, when testing for library call.
Index: i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.829
diff -c -3 -p -r1.829 i386.c
*************** ix86_eax_live_at_start_p (void)
*** 1943,1949 ****
int
ix86_return_pops_args (tree fundecl, tree funtype, int size)
{
! int rtd = TARGET_RTD && (!fundecl || TREE_CODE (fundecl) !=
IDENTIFIER_NODE);
/* Cdecl functions override -mrtd, and never pop the stack. */
if (! lookup_attribute ("cdecl", TYPE_ATTRIBUTES (funtype))) {
--- 1943,1949 ----
int
ix86_return_pops_args (tree fundecl, tree funtype, int size)
{
! int rtd = TARGET_RTD && (!funtype || TREE_CODE (funtype) !=
IDENTIFIER_NODE);
/* Cdecl functions override -mrtd, and never pop the stack. */
if (! lookup_attribute ("cdecl", TYPE_ATTRIBUTES (funtype))) {
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22017