aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2004-02-04 00:53:48 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2004-02-03 23:53:48 +0000
commit40e02b4a76a59504e2708e7012dddd0eafb9d423 (patch)
treee424fd93830b970cdf079b0ff3e3a0b50f7ca486
parent1c02f6f2d28a9f8cfe03a0e79356ddec64f8ad8f (diff)
downloadgcc-40e02b4a76a59504e2708e7012dddd0eafb9d423.zip
gcc-40e02b4a76a59504e2708e7012dddd0eafb9d423.tar.gz
gcc-40e02b4a76a59504e2708e7012dddd0eafb9d423.tar.bz2
alias.c (find_base_term, get_addr): Do not dereference NULL pointer when all VALUE's locations has been invalidated.
* alias.c (find_base_term, get_addr): Do not dereference NULL pointer when all VALUE's locations has been invalidated. (rtx_equal_for_memref_p): Simplify checking of VALUEs. From-SVN: r77201
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/alias.c25
2 files changed, 20 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 28688c9..cdf9076 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2004-02-04 Jan Hubicka <jh@suse.cz>
+
+ * alias.c (find_base_term, get_addr): Do not dereference NULL
+ pointer when all VALUE's locations has been invalidated.
+ (rtx_equal_for_memref_p): Simplify checking of VALUEs.
+
2004-02-03 Wolfgang Bangerth <bangerth@dealii.org>
* doc/invoke.texi (x86 options): Fix spelling/wording.
diff --git a/gcc/alias.c b/gcc/alias.c
index 00060fce..f0cfe4c 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -1139,9 +1139,6 @@ rtx_equal_for_memref_p (rtx x, rtx y)
/* Some RTL can be compared without a recursive examination. */
switch (code)
{
- case VALUE:
- return CSELIB_VAL_PTR (x) == CSELIB_VAL_PTR (y);
-
case REG:
return REGNO (x) == REGNO (y);
@@ -1151,6 +1148,7 @@ rtx_equal_for_memref_p (rtx x, rtx y)
case SYMBOL_REF:
return XSTR (x, 0) == XSTR (y, 0);
+ case VALUE:
case CONST_INT:
case CONST_DOUBLE:
/* There's no need to compare the contents of CONST_DOUBLEs or
@@ -1325,6 +1323,8 @@ find_base_term (rtx x)
case VALUE:
val = CSELIB_VAL_PTR (x);
+ if (!val)
+ return 0;
for (l = val->locs; l; l = l->next)
if ((x = find_base_term (l->loc)) != 0)
return x;
@@ -1502,14 +1502,17 @@ get_addr (rtx x)
if (GET_CODE (x) != VALUE)
return x;
v = CSELIB_VAL_PTR (x);
- for (l = v->locs; l; l = l->next)
- if (CONSTANT_P (l->loc))
- return l->loc;
- for (l = v->locs; l; l = l->next)
- if (GET_CODE (l->loc) != REG && GET_CODE (l->loc) != MEM)
- return l->loc;
- if (v->locs)
- return v->locs->loc;
+ if (v)
+ {
+ for (l = v->locs; l; l = l->next)
+ if (CONSTANT_P (l->loc))
+ return l->loc;
+ for (l = v->locs; l; l = l->next)
+ if (GET_CODE (l->loc) != REG && GET_CODE (l->loc) != MEM)
+ return l->loc;
+ if (v->locs)
+ return v->locs->loc;
+ }
return x;
}