ssa-ccp.c (ssa_ccp_substitute_constants): Don't crash if def is NULL.

* ssa-ccp.c (ssa_ccp_substitute_constants): Don't crash if def
	is NULL.
	* gcc.dg/20020304-1.c: New test.

From-SVN: r50311
This commit is contained in:
Jakub Jelinek 2002-03-05 12:01:09 +01:00 committed by Jakub Jelinek
parent a562995d91
commit 6d05169401
4 changed files with 52 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2002-03-05 Jakub Jelinek <jakub@redhat.com>
* ssa-ccp.c (ssa_ccp_substitute_constants): Don't crash if def
is NULL.
2002-03-05 Richard Henderson <rth@redhat.com>
* rs6000.h (TOTAL_ALTIVEC_REGS): Fix off-by-one error.

View File

@ -856,10 +856,14 @@ ssa_ccp_substitute_constants ()
{
if (values[i].lattice_val == CONSTANT)
{
rtx def = VARRAY_RTX (ssa_definition, i);
rtx set = single_set (def);
rtx def = VARRAY_RTX (ssa_definition, i), set;
struct df_link *curruse;
/* Definition might have been deleted already. */
if (! def)
continue;
set = single_set (def);
if (! set)
continue;

View File

@ -1,3 +1,7 @@
2002-03-05 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/20020304-1.c: New test.
2002-03-04 Zack Weinberg <zack@codesourcery.com>
* gcc.c-torture/compile/20020304-1.c: New test case

View File

@ -0,0 +1,37 @@
/* { dg-do compile } */
/* { dg-options "-O -fssa -fssa-ccp" } */
double a[10][35], b[10][8];
int c, c, d, e, f, g, h;
int foo ()
{
int i, j, k, l;
if (c > 10)
c = 10;
for (j = 0; j < c; j++)
{
k = 0;
for (l = 0; l < h; l++)
{
if (d != 5)
return -1;
k = l * g;
a[j][k] = (double) e; k++;
a[j][k] = (double) f; k++;
}
for (i = 0;i < 35; i++)
{
if (a[j][i] >= 0.9)
a[j][i] = 0.9;
if (a[j][i] <= 0.1)
a[j][i] = 0.1;
}
k = 0;
b[j][k] = (double) e; k++;
b[j][k] = (double) f; k++;
}
return 0;
}