Fix indirect sibcall check for MIPS16 functions
Richard Sandiford
rdsandiford@googlemail.com
Sat Sep 6 13:52:00 GMT 2008
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;
More information about the Gcc-patches
mailing list