This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] for target/PR1704: ICE for tail call of regparm 3 and dllimport
- From: Danny Smith <dannysmith at clear dot net dot nz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 31 Jan 2005 08:55:15 +1300
- Subject: [PATCH] for target/PR1704: ICE for tail call of regparm 3 and dllimport
- Reply-to: Danny Smith <dannysmith at users dot sourceforge dot net>
Hello
Dllimport'd functions are called indirectly. This patch checks that we
have a call-clobbered register available for the address of the
function when deciding if ok for sibcall..
Tested i686-pc-mingw32.
OK for mainline?
Danny
2005-01-30 Danny Smith <dannysmith@users.sourceforge.net>
PR target/19704
* config/i386/i386.c (ix86_function_ok_for_sibcall): Also check
that dllimport'd functions do not use all call-clobbered registers
to pass parameters.
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.792
diff -c -3 -p -r1.792 i386.c
*** config/i386/i386.c 28 Jan 2005 09:16:50 -0000 1.792
--- config/i386/i386.c 30 Jan 2005 19:32:09 -0000
*************** ix86_function_ok_for_sibcall (tree decl,
*** 1678,1683 ****
--- 1678,1690 ----
}
}
+ #if TARGET_DLLIMPORT_DECL_ATTRIBUTES
+ /* Dllimport'd functions are also called indirectly. */
+ if (decl && lookup_attribute ("dllimport", DECL_ATTRIBUTES (decl))
+ && ix86_function_regparm (TREE_TYPE (decl), NULL) >= 3)
+ return false;
+ #endif
+
/* Otherwise okay. That also includes certain types of indirect calls. */
return true;
}