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]
Other format: [Raw text]

Re: [patch] Store motion rewrite


> Hello,

Hello Zdenek,

> source of this problem is a latent bug in strength reduction. It works
> this way -- we have the following code:
>
> [...]
> What we do is apparently wrong; the problem is that one of the
> prerequisities mentioned in record_giv:
>   - no assignments to the biv occur during the giv's lifetime.
> is not satisfied. The check verifying this property passes when it
> should fail because the last insn in that r131 is used is new one
> and it has no luid assigned (and we read behind the uid_luid array!).

Well spotted!

> The patch below fixes it by providing conservative defaults for
> REGNO_FIRST_LUID and REGNO_LAST_LUID; perhaps it would be better
> to put aborts there and instead correctly update luids (but I am not
> going to spend my time on this).
>
> 	* loop.h (REGNO_FIRST_LUID, REGNO_LAST_LUID): Provide defaults
> 	for insns without luid.

This patch alone (i.e. without the previous patch in this thread) does fix 
the regression on sparc-sun-solaris2.9. 

Moreover, I confirm that the previous patch is the fix for PR 
optimization/10312. I've attached a testcase for gcc.c-torture/execute.

Thanks.

-- 
Eric Botcazou
/* PR optimization/10312 */
/* Originator: Peter van Hoof <p dot van-hoof at qub dot ac dot uk> */

/* Verify that the strength reduction pass doesn't find
   illegitimate givs.  */

struct {
  double a;
  int n[2];
} g = { 0., { 1, 2 } };

int k = 0;

void b(int *j) {}

int main()
{
  int j;
  
  for (j=0; j < 2; j++)
    k = ( k > g.n[j] ) ? k : g.n[j];

  k++;
  b(&j);

  return 0;
}

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