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

            Bug ID: 116019
           Summary: Incorrect cannot-tail messages on targets
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andi-gcc at firstfloor dot org
  Target Milestone: ---

(bug requires musttail patchkit comitted)

This is related to PR115606

On targets like ARM where the C++ frontend prevents tail calls returning
structures we also get incorrect tail call errors.

for example for runing cc1plus on testsuite/c-c++-common musttail12.c

get

../gcc/gcc/testsuite/c-c++-common/musttail12.c: In function ‘str cstruct(int)’:
../gcc/gcc/testsuite/c-c++-common/musttail12.c:13:38: error: cannot tail-call:
tail call must be same type

but they are on the same type and work for on x86.

  tree result_decl = DECL_RESULT (cfun->decl);
  if (result_decl
      && may_be_aliased (result_decl)
      && ref_maybe_used_by_stmt_p (call, result_decl, false))
    {
      maybe_error_musttail (call, _("tail call must be same type"));
      return;
    }

so this error message needs to be fixed to handle such a implicit case.

Reply via email to