This is the mail archive of the
mailing list for the GCC project.
Re: [new-regalloc] Problem on x86 with initialization of ra_reg_info
- To: "Daniel Berlin" <dberlin at redhat dot com>
- Subject: Re: [new-regalloc] Problem on x86 with initialization of ra_reg_info
- From: "Geert Bosch" <bosch at gnat dot com>
- Date: Fri, 02 Feb 2001 13:57:45 -0500
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>,"Richard Henderson" <rth at redhat dot com>
- Reply-To: "Geert Bosch" <bosch at gnat dot com>
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 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))