This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix indirect sibcall check for MIPS16 functions
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 06 Sep 2008 10:21:41 +0100
- Subject: Fix indirect sibcall check for MIPS16 functions
MIPS doesn't allow direct sibcalls to MIPS16 functions, because there's
no direct jump instruction that swaps the ISA mode. The check for this
case would segfault for indirect calls, where no decl is available.
Tested on mipsisa64-elfoabi and applied. The testcase is
r10k-cache-barrier-13.c
Richard
gcc/
* config/mips/mips.c (mips_function_ok_for_sibcall): Check for
DECL being null.
Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c 2008-09-06 10:10:24.000000000 +0100
+++ gcc/config/mips/mips.c 2008-09-06 10:10:30.000000000 +0100
@@ -6173,7 +6173,8 @@ mips_function_ok_for_sibcall (tree decl,
because there is no direct "jx" instruction equivalent to "jalx" to
switch the ISA mode. We only care about cases where the sibling
and normal calls would both be direct. */
- if (mips_use_mips16_mode_p (decl)
+ if (decl
+ && mips_use_mips16_mode_p (decl)
&& const_call_insn_operand (XEXP (DECL_RTL (decl), 0), VOIDmode))
return false;