Hello.

I'm not fully familiar with code in warn_dealloc_offset, but I guess
the following can work.

Martin, what do you think?

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

        PR tree-optimization/98160
        * builtins.c (warn_dealloc_offset): Handle OBJ_TYPE_REF as
        def_stmt.
---
 gcc/builtins.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/builtins.c b/gcc/builtins.c
index 28e44445ab2..057a5b1a973 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -13410,7 +13410,7 @@ warn_dealloc_offset (location_t loc, tree exp, const 
access_ref &aref)
          if (is_gimple_call (def_stmt))
            {
              tree alloc_decl = gimple_call_fndecl (def_stmt);
-             if (!DECL_IS_OPERATOR_NEW_P (alloc_decl))
+             if (alloc_decl == NULL_TREE || !DECL_IS_OPERATOR_NEW_P 
(alloc_decl))
                return false;
            }
        }
--
2.29.2

Reply via email to