This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] PR 48837
- From: Jeff Law <law at redhat dot com>
- To: Zdenek Dvorak <rakdver at kam dot mff dot cuni dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 06 May 2011 09:07:38 -0600
- Subject: Re: [patch] PR 48837
- References: <20110506104417.GA8664@kam.mff.cuni.cz>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 05/06/11 04:44, Zdenek Dvorak wrote:
> Hi,
>
> when accumulator transformation is performed on a function like
>
> foo(a)
> {
> if (a > 0)
> return 1 + foo (a - 1)
>
> return bla();
> }
>
> this becomes
>
> foo(a)
> {
> int tmp = 0;
>
> while (a > 0)
> tm = 1 + tmp;
>
> return tmp + bla();
> }
>
> Before, bla was a tail-call, but after the optimization, it is not (since an addition
> has to be performed after the result of bla is known). However, we used to mark bla
> as tail-call, leading to a misscompilation later. Fixed by not marking tail-calls
> when the transformation is performed. Bootstrapped and regtested on i686.
>
> Zdenek
>
> PR tree-optimization/48837
> * tree-tailcall.c (tree_optimize_tail_calls_1): Do not mark tailcalls
> when accumulator transformation is performed.
>
> * gcc.dg/pr48837.c: New testcase.
OK.
Thanks,
jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJNxA66AAoJEBRtltQi2kC7yysIAKZYUpU9JlyH2XwvvVslq8C1
CJ7E/akRDsBoYBS+syNsLMwkbGG0WoaFJzOd7vUmIknAHEusF6OasczsN8PD9aEB
i8xJNTZm2yxhrVZh8m/KBX96r80RwzpAhr9L1WAspiS/xpw12lRoJoh3XeKXYXWw
Z0aBL4ljCgLj6GKEyy7FbGHx0gEqaa1x7EDM1kJGCgZPAFJalJPozBiiriYL9/Th
gHqLXZ0HUhXNGql5M2S+lfZG2d30Rj1KBXDrU8EOXedHRjxb+U9+WLGsUHZtkcTI
j3//n6bjTr/YmyTe43voG3Rn6z6k0g2Eb8gF8UMvDbaSJlH9+xb6SuWLS8+mEhY=
=luE9
-----END PGP SIGNATURE-----