As described in PR50146, a recent change to ira-color.c caused trunk to
fail to bootstrap on ARM.  The issue is that a new variable saved_nregs
is declared unconditionally but used #ifndef HONOR_REG_ALLOC_ORDER.  Since
the ARM backend defines HONOR_REG_ALLOC_ORDER, an 'unused variable' warning
results, which becomes a hard error in stage 2.

Fixed by moving the declaration to the #ifndef HONOR_REG_ALLOC_ORDER block
of variable declarations.  With this in place bootstrap succeeds on
armv5tel-linux-gnueabi.

Patch was pre-approved by Vladimir Makarov in the PR trail, but I don't
have svn write access so I'll need help to commit it.

/Mikael

gcc/

2011-08-22  Mikael Pettersson  <mi...@it.uu.se>

        PR bootstrap/50146
        * ira-color.c (assign_hard_reg): Move saved_nregs declaration
        to #ifndef HONOR_REG_ALLOC_ORDER block.

--- gcc-4.7-20110820/gcc/ira-color.c.~1~        2011-08-18 16:56:36.000000000 
+0200
+++ gcc-4.7-20110820/gcc/ira-color.c    2011-08-21 19:11:00.000000000 +0200
@@ -1567,13 +1567,14 @@ static bool
 assign_hard_reg (ira_allocno_t a, bool retry_p)
 {
   HARD_REG_SET conflicting_regs[2], profitable_hard_regs[2];
-  int i, j, hard_regno, best_hard_regno, class_size, saved_nregs;
+  int i, j, hard_regno, best_hard_regno, class_size;
   int cost, mem_cost, min_cost, full_cost, min_full_cost, nwords, word;
   int *a_costs;
   enum reg_class aclass;
   enum machine_mode mode;
   static int costs[FIRST_PSEUDO_REGISTER], full_costs[FIRST_PSEUDO_REGISTER];
 #ifndef HONOR_REG_ALLOC_ORDER
+  int saved_nregs;
   enum reg_class rclass;
   int add_cost;
 #endif

Reply via email to