This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: combine_givs_p address cost
Michael Hayes writes:
> Richard Henderson writes:
> > Here's a possible approach. It happens to work for your testcase;
> > I would be interested to find out what happens on other tests.
>
> Unfortunately, this patch causes egcs to segfault in
> combine_givs_benefit_from since g2->location is NULL.
This patch fixes the segfault problem.
*** loop.c.rth Sat Nov 28 13:30:49 1998
--- loop.c Sat Nov 28 13:28:00 1998
*************** combine_givs_benefit_from (g1, g2, new_p
*** 6334,6339 ****
--- 6334,6341 ----
tmp = g2->benefit;
if ((g1->giv_type == DEST_ADDR) != (g2->giv_type == DEST_ADDR))
{
+ if (g2->giv_type != DEST_ADDR)
+ g2 = g1;
#ifdef ADDRESS_COST
tmp -= ADDRESS_COST (new_pattern);
tmp += ADDRESS_COST (*g2->location);