This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug bootstrap/44921] [4.6 Regression] Failed to bootstrap



------- Comment #2 from amylaar at gcc dot gnu dot org  2010-07-12 22:54 -------
(In reply to comment #1)
> This patch:
> 
> Index: postreload.c
> ===================================================================
> --- postreload.c        (revision 162085)
> +++ postreload.c        (working copy)
> @@ -1281,7 +1281,7 @@ move2add_use_add3_insn (rtx reg, rtx sym
>    rtx src = SET_SRC (pat);
>    int regno = REGNO (reg);
>    int min_cost = INT_MAX;
> -  int min_regno;
> +  int min_regno = -1;
>    bool speed = optimize_bb_for_speed_p (BLOCK_FOR_INSN (insn));
>    int i;
> 
> @@ -1317,7 +1317,7 @@ move2add_use_add3_insn (rtx reg, rtx sym
>           }
>        }
> 
> -  if (min_cost < rtx_cost (src, SET, speed))
> +  if (min_regno >= 0 && min_cost < rtx_cost (src, SET, speed))
>      {
>        rtx tem;
> 
> works for me.

The variable can not actually be used uninitalized, since min_cost is
initalized to INT_MAX, and the return type of rtx_cost is int.
So it is enough to shut up the compiler warning, no need to add an
extra test there.  I.e. the first hunk should be sufficient.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44921


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]