This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/74563] [6/7 regression] Classic MIPS16 (non-MIPS16e) function return broken


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=74563

--- Comment #6 from Maciej W. Rozycki <macro@linux-mips.org> ---
Created attachment 41199
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41199&action=edit
Possible fix

FYI, I think this has been caused by r227385, see how `<optab>_internal'
is used by `mips_expand_epilogue':

              /* simple_returns cannot rely on values that are only available
                 on paths through the epilogue (because return paths that do
                 not pass through the epilogue may nevertheless reuse a
                 simple_return that occurs at the end of the epilogue).
                 Use a normal return here instead.  */
              rtx reg = gen_rtx_REG (Pmode, GP_REG_FIRST + 7);
              pat = gen_return_internal (reg);

and what looks like an inadvertent addition of:

    operands[0] = gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM);

there:

@@ -6522,12 +6543,10 @@
   [(any_return)
    (use (match_operand 0 "pmode_register_operand" ""))]
   ""
-{
-  if (TARGET_MICROMIPS)
-    return "%*jr%:\t%0";
-  else
-    return "%*j\t%0%/";
-}
+  {
+    operands[0] = gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM);
+    return mips_output_jump (operands, 0, -1, false);
+  }
   [(set_attr "type"    "jump")
    (set_attr "mode"    "none")])

Patch attached may fix it, untested.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]