Fixes e.g. c-c++-common/Wsizeof-pointer-memaccess1.c

gcc/ChangeLog:
        * fold-const.c (operand_equal_p): Handle location wrappers.
        * tree.c (inchash::add_expr): Likewise.
---
 gcc/fold-const.c | 3 +++
 gcc/tree.c       | 1 +
 2 files changed, 4 insertions(+)

diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index e9cd968..ababa68 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -2802,6 +2802,9 @@ operand_equal_p (const_tree arg0, const_tree arg1, 
unsigned int flags)
          != TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (arg1)))))
     return 0;
 
+  STRIP_ANY_LOCATION_WRAPPER (arg0);
+  STRIP_ANY_LOCATION_WRAPPER (arg1);
+
   /* Check equality of integer constants before bailing out due to
      precision differences.  */
   if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST)
diff --git a/gcc/tree.c b/gcc/tree.c
index f71b484..6ef290d 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -7092,6 +7092,7 @@ add_expr (const_tree t, inchash::hash &hstate, unsigned 
int flags)
 
   if (!(flags & OEP_ADDRESS_OF))
     STRIP_NOPS (t);
+  STRIP_ANY_LOCATION_WRAPPER (t);
 
   code = TREE_CODE (t);
 
-- 
1.8.5.3

Reply via email to