void *t(); char *f() { return t(); }
This is related to bug 14440 which is because they are the same size (_Bool is the same size as int on powerpc-apple-darwin).
This is a dup of bug 14441, the patch which fixes that also fixes this one. *** This bug has been marked as a duplicate of 14441 ***
Re-introduced by: 2004-06-07 Richard Henderson <rth@redhat.com> * gimple-low.c (struct lower_data): Add the_return_label and one_return_stmt. (lower_function_body): Initialize and use them. (lower_return_expr): New. (lower_stmt): Call it. * gimplify.c (gimplify_return_expr): Force the argument to be either null or a result_decl. * tree-gimple.c: Update gimple grammer to match. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Deny coalescing of result_decls. The problem is that return statements no longer have stuff in them any more.
Here is the testcase I would add to the testsuite so this does not happen again: /* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-tailc-details" } */ void *t(); char *f() { return t(); } /* { dg-final { scan-tree-dump-times "Found tail call" 1 "tailc"} } */
Testing a patch.
Subject: Bug 15108 CVSROOT: /cvs/gcc Module name: gcc Changes by: rth@gcc.gnu.org 2004-06-09 23:48:57 Modified files: gcc : ChangeLog tree-tailcall.c Log message: PR opt/15108 * tree-tailcall.c (find_tail_calls): Don't check early for tail_recursion failure. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3900&r2=2.3901 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-tailcall.c.diff?cvsroot=gcc&r1=2.6&r2=2.7
Fixed.