This is the mail archive of the gcc-patches@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]

Re: [new-regalloc] Problem on x86 with initialization of ra_reg_info


On Fri, 2 Feb 2001 13:37:43 -0500 (EST), Daniel Berlin wrote:
``Yes it does. There is no point in considering non hard, non fixed
registers, that are never set, anywhere.''

But the issue is that ra_reg_info[xxx] is 0 for registers that
are not candidates. Clearly the code below then dereferences a
nullpointer if reg_num is the number of a register which is not
a candidate. On the x86 this happens when compiling libgcc2.a (reg_num == 6).

So which of these statements is true:
  - ra_reg_info[regnum] should not be a null pointer
  - we should not execute this code when regnum is not a candidate
  - the test should check that ra_reg_info[regnum] is not null

Clearly it is not valid to dereference a null pointer...  

  > The new register allocator crashes badly on x86 at line 703 of
  > new-regalloc.c, trying to access the degree of ra_reg_info[6] which
  > is 0:
  >       /* If it's of significant degree, place it on the spill_worklist.  */
  >       if (ra_reg_info[reg_num]->degree >= reg_freedom (reg_num))





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