if (optimize)
return true;
+ /* Thunks force a tail call even at -O0 so we need to avoid creating a
+ dangling reference in case the parameter is passed by reference. */
+ if (TREE_CODE (decl) == PARM_DECL && cfun->tail_call_marked)
+ return true;
+
if (!DECL_REGISTER (decl))
return false;
of the parameter instead. */
if (data->arg.pass_by_reference && TYPE_MODE (TREE_TYPE (parm)) != BLKmode)
{
- /* Use a stack slot for debugging purposes, except if a tail call is
- involved because this would create a dangling reference. */
- if (use_register_for_decl (parm) || cfun->tail_call_marked)
+ /* Use a stack slot for debugging purposes if possible. */
+ if (use_register_for_decl (parm))
{
parmreg = gen_reg_rtx (TYPE_MODE (TREE_TYPE (parm)));
mark_user_reg (parmreg);
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffloat-store" } */
+
+extern void foo (long double);
+
+void bar (long double d)
+{
+ foo (d);
+}