more m68k breakage on m68k-linux

Bernardo Innocenti bernie@develer.com
Wed Mar 3 08:22:00 GMT 2004


Richard Zidlicky wrote:

>>>Note the typo "FIRST_PSEOUDO_REGISTER".. made it somewhat hard to
>>>find the change.
>>
>>Oops!  That's very unfortunate.  I've fixed it in the ChangeLog.
> 
> thanks.. I should have used agrep or something :)

What's that?  Is it perhaps an heuristic version of grep?
I'd badly need something like that! :-)


>>If I didn't increment FIRST_PSEUDO_REGISTER, register 25 would
>>be used both as the argptr and as a placeholder for some
>>temporary register, with very interesting consequences :-)
> 
> hm.. the problem I see is that the register allocator is initialised
> with random garbage. Eg FIXED_REGISTERS is 24 elts big, thus 
> initial_fixed_regs[] is also only 24 elts and in init_reg_sets() we
> copy a random 25th elt into fixed_regs[] and risk segfault.
> I am pretty sure more it results in more damage later on.

That's a nice catch, and it would explain all the strange
bootstrap failures we've seen, but... I can't see this bug
in current mainline code:

void
init_reg_sets (void)
{
  int i, j;

  /* First copy the register information from the initial int form into
     the regsets.  */

  for (i = 0; i < N_REG_CLASSES; i++)
    {
      CLEAR_HARD_REG_SET (reg_class_contents[i]);

      /* Note that we hard-code 32 here, not HOST_BITS_PER_INT.  */
      for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
        if (int_reg_class_contents[i][j / 32]
            & ((unsigned) 1 << (j % 32)))
          SET_HARD_REG_BIT (reg_class_contents[i], j);
    }

  memcpy (fixed_regs, initial_fixed_regs, sizeof fixed_regs);
  memcpy (call_used_regs, initial_call_used_regs, sizeof call_used_regs);
  memset (global_regs, 0, sizeof global_regs);

  /* Do any additional initialization regsets may need.  */
  INIT_ONCE_REG_SET ();

#ifdef REG_ALLOC_ORDER
  for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
    inv_reg_alloc_order[reg_alloc_order[i]] = i;
#endif
}

Moreover, CVS annotate shows that this function has not been
changed significantly since year 2000.

-- 
  // Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/  http://www.develer.com/




More information about the Gcc mailing list