From 0de349f108d963219bd59aa374a68c15355236be Mon Sep 17 00:00:00 2001
From: Jeff Law <law@redhat.com>
Date: Wed, 29 Jan 2020 12:23:53 -0700
Subject: Improve DSE which in turn eliminates the need for jump threading and
 block duplication for the original testcase in pr89689 which in turn
 eliminates the false positive -Warray-bounds warning for the original
 testcase.

	PR tree-optimization/89689
	* builtins.def (BUILT_IN_OBJECT_SIZE): Make it const rather than pure.

	PR tree-optimization/89689
	* gcc.dg/pr89689.c: New test.
---
 gcc/builtins.def | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'gcc/builtins.def')

diff --git a/gcc/builtins.def b/gcc/builtins.def
index 5ab842c..fa8b064 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -972,7 +972,7 @@ DEF_BUILTIN_STUB (BUILT_IN_STRCMP_EQ, "__builtin_strcmp_eq")
 DEF_BUILTIN_STUB (BUILT_IN_STRNCMP_EQ, "__builtin_strncmp_eq")
 
 /* Object size checking builtins.  */
-DEF_GCC_BUILTIN	       (BUILT_IN_OBJECT_SIZE, "object_size", BT_FN_SIZE_CONST_PTR_INT, ATTR_PURE_NOTHROW_LEAF_LIST)
+DEF_GCC_BUILTIN	       (BUILT_IN_OBJECT_SIZE, "object_size", BT_FN_SIZE_CONST_PTR_INT, ATTR_CONST_NOTHROW_LEAF_LIST)
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_MEMCPY_CHK, "__memcpy_chk", BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_MEMMOVE_CHK, "__memmove_chk", BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_MEMPCPY_CHK, "__mempcpy_chk", BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, ATTR_RETNONNULL_NOTHROW_LEAF)
-- 
cgit v1.1

