This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Two more cases where we compare addresses
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 7 Oct 2015 07:43:32 +0200
- Subject: Two more cases where we compare addresses
- Authentication-results: sourceware.org; auth=none
Hi,
this patch fixes use of operand_equal_p in fold_comparison where
we compare two addresses for equivalence and in fold_addr_of_array_ref_difference.
Bootstrapped/regtested x86_64-linux, OK?
Honza
* fold-const.c (fold_comparison, fold_addr_of_array_ref_difference):
Pass OEP_ADDRESS_OF flag to operand_equal_p.
Index: fold-const.c
===================================================================
--- fold-const.c (revision 228131)
+++ fold-const.c (working copy)
@@ -8386,7 +8443,7 @@ fold_comparison (location_t loc, enum tr
/* If we have equivalent bases we might be able to simplify. */
if (indirect_base0 == indirect_base1
- && operand_equal_p (base0, base1, 0))
+ && operand_equal_p (base0, base1, OEP_ADDRESS_OF))
{
/* We can fold this expression to a constant if the non-constant
offset parts are equal. */
@@ -8806,7 +8863,7 @@ fold_addr_of_array_ref_difference (locat
&& (base_offset = fold_binary_loc (loc, MINUS_EXPR, type,
TREE_OPERAND (base0, 0),
TREE_OPERAND (base1, 0))))
- || operand_equal_p (base0, base1, 0))
+ || operand_equal_p (base0, base1, OEP_ADDRESS_OF))
{
tree op0 = fold_convert_loc (loc, type, TREE_OPERAND (aref0, 1));
tree op1 = fold_convert_loc (loc, type, TREE_OPERAND (aref1, 1));