https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114207

--- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
The offset gets lost in ipa-prop.cc

diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc
index 7d7cb3835d2..99ebd6229ec 100644
--- a/gcc/ipa-prop.cc
+++ b/gcc/ipa-prop.cc
@@ -1370,9 +1370,9 @@ unadjusted_ptr_and_unit_offset (tree op, tree *ret,
poly_int64 *offset_ret)
     {
       if (TREE_CODE (op) == ADDR_EXPR)
        {
-         poly_int64 extra_offset = 0;
+         poly_int64 extra_offset;
          tree base = get_addr_base_and_unit_offset (TREE_OPERAND (op, 0),
-                                                    &offset);
+                                                    &extra_offset);
          if (!base)
            {
              base = get_base_address (TREE_OPERAND (op, 0));

here offset is the offset being tracked and get_addr_base_and_unit_offset is
intended to initialize extra_offset which is later added to offset.

In the testcase the pointer is first offseted by +4 and later by -4 which
combines to 0.

Reply via email to