diff mbox

Fix PR ipa/58862 (overflow in edge_badness computation)

Message ID CAAe5K+WYwsMSO63=mf9K16ESzCS74EnT64qjHghgKiWT0XDD_g@mail.gmail.com
State New
Headers show

Commit Message

Teresa Johnson Nov. 13, 2013, 2:48 p.m. UTC
The following fixes PR ipa/58862, which caused failures in lto
profiledbootstrap and in several spec cpu2006 profile-use builds.

Bootstrapped and tested on x86-64-unknown-linux-gnu. Also ensured that
it fixed the lto profiledbootstrap and cpu2006 failures. Ok for trunk?

Thanks,
Teresa

2013-11-13  Teresa Johnson  <tejohnson@google.com>

        PR ipa/58862
        * ipa-inline.c (edge_badness): Fix overflow.

Comments

Jan Hubicka Nov. 13, 2013, 9:40 p.m. UTC | #1
> The following fixes PR ipa/58862, which caused failures in lto
> profiledbootstrap and in several spec cpu2006 profile-use builds.
> 
> Bootstrapped and tested on x86-64-unknown-linux-gnu. Also ensured that
> it fixed the lto profiledbootstrap and cpu2006 failures. Ok for trunk?
> 
> Thanks,
> Teresa
> 
> 2013-11-13  Teresa Johnson  <tejohnson@google.com>
> 
>         PR ipa/58862
>         * ipa-inline.c (edge_badness): Fix overflow.

OK,
thanks!
Honza
> 
> Index: ipa-inline.c
> ===================================================================
> --- ipa-inline.c        (revision 204703)
> +++ ipa-inline.c        (working copy)
> @@ -909,7 +909,7 @@ edge_badness (struct cgraph_edge *edge, bool dump)
>        /* Capping edge->count to max_count. edge->count can be larger than
>          max_count if an inline adds new edges which increase max_count
>          after max_count is computed.  */
> -      int edge_count = edge->count > max_count ? max_count : edge->count;
> +      gcov_type edge_count = edge->count > max_count ? max_count : edge->count;
> 
>        sreal_init (&relbenefit_real, relbenefit, 0);
>        sreal_init (&growth_real, growth, 0);
> 
> 
> -- 
> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413
diff mbox

Patch

Index: ipa-inline.c
===================================================================
--- ipa-inline.c        (revision 204703)
+++ ipa-inline.c        (working copy)
@@ -909,7 +909,7 @@  edge_badness (struct cgraph_edge *edge, bool dump)
       /* Capping edge->count to max_count. edge->count can be larger than
         max_count if an inline adds new edges which increase max_count
         after max_count is computed.  */
-      int edge_count = edge->count > max_count ? max_count : edge->count;
+      gcov_type edge_count = edge->count > max_count ? max_count : edge->count;

       sreal_init (&relbenefit_real, relbenefit, 0);
       sreal_init (&growth_real, growth, 0);