re PR tree-optimization/36830 (STORAGE_ERROR raised compiling s-os_lib.adb)

PR tree-optimization/36830
	* tree-ssa-sccvn.c (vn_reference_op_compute_hash): Hash operand #2.
	(expressions_equal_p): Return false if only one operand is null.

From-SVN: r138191
This commit is contained in:
Eric Botcazou 2008-07-27 16:55:31 +00:00 committed by Eric Botcazou
parent 82ca2a5146
commit 330e765e13
2 changed files with 21 additions and 11 deletions

View file

@ -1,3 +1,9 @@
2008-07-27 Eric Botcazou <ebotcazou@adacore.com>
PR tree-optimization/36830
* tree-ssa-sccvn.c (vn_reference_op_compute_hash): Hash operand #2.
(expressions_equal_p): Return false if only one operand is null.
2008-07-26 Gerald Pfeifer <gerald@pfeifer.com> 2008-07-26 Gerald Pfeifer <gerald@pfeifer.com>
* doc/install.texi (powerpc-*-netbsd*): Remove redundant texinfo * doc/install.texi (powerpc-*-netbsd*): Remove redundant texinfo

View file

@ -319,7 +319,8 @@ static hashval_t
vn_reference_op_compute_hash (const vn_reference_op_t vro1) vn_reference_op_compute_hash (const vn_reference_op_t vro1)
{ {
return iterative_hash_expr (vro1->op0, vro1->opcode) return iterative_hash_expr (vro1->op0, vro1->opcode)
+ iterative_hash_expr (vro1->op1, vro1->opcode); + iterative_hash_expr (vro1->op1, vro1->opcode)
+ iterative_hash_expr (vro1->op2, vro1->opcode);
} }
/* Return the hashcode for a given reference operation P1. */ /* Return the hashcode for a given reference operation P1. */
@ -2587,22 +2588,24 @@ get_next_value_id (void)
} }
/* Compare two expressions E1 and E2 and return true if they are /* Compare two expressions E1 and E2 and return true if they are equal. */
equal. */
bool bool
expressions_equal_p (tree e1, tree e2) expressions_equal_p (tree e1, tree e2)
{ {
tree te1, te2; /* The obvious case. */
if (e1 == e2) if (e1 == e2)
return true; return true;
te1 = TREE_TYPE (e1); /* If only one of them is null, they cannot be equal. */
te2 = TREE_TYPE (e2); if (!e1 || !e2)
if (te1 != te2)
return false; return false;
/* Likewise if they are not of the same type. */
if (TREE_TYPE (e1) != TREE_TYPE (e2))
return false;
/* Recurse on elements of lists. */
if (TREE_CODE (e1) == TREE_LIST && TREE_CODE (e2) == TREE_LIST) if (TREE_CODE (e1) == TREE_LIST && TREE_CODE (e2) == TREE_LIST)
{ {
tree lop1 = e1; tree lop1 = e1;
@ -2617,10 +2620,11 @@ expressions_equal_p (tree e1, tree e2)
return false; return false;
} }
return true; return true;
} }
else if (TREE_CODE (e1) == TREE_CODE (e2)
&& operand_equal_p (e1, e2, OEP_PURE_SAME)) /* Now perform the actual comparison. */
if (TREE_CODE (e1) == TREE_CODE (e2)
&& operand_equal_p (e1, e2, OEP_PURE_SAME))
return true; return true;
return false; return false;