aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2014-11-26 14:05:21 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2014-11-26 14:05:21 +0000
commit0bae64d5800c779f2ee6aa5b823a9031f24a0fb2 (patch)
treebaa9fe5437805d6c07f699e75c56205d9e833777
parent3c350d48a595d93c3e6336b79091d7f506a5fb03 (diff)
downloadgcc-0bae64d5800c779f2ee6aa5b823a9031f24a0fb2.zip
gcc-0bae64d5800c779f2ee6aa5b823a9031f24a0fb2.tar.gz
gcc-0bae64d5800c779f2ee6aa5b823a9031f24a0fb2.tar.bz2
re PR sanitizer/63788 (ICE: SIGSEGV in contains_struct_check with -O -fsanitize=undefined on almost any fortran code)
PR sanitizer/63788 * asan.c (initialize_sanitizer_builtins): Add BT_FN_SIZE_CONST_PTR_INT var. Conditionally build BUILT_IN_OBJECT_SIZE decl. (ATTR_PURE_NOTHROW_LEAF_LIST): Define. From-SVN: r218084
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/asan.c14
2 files changed, 21 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9f2d701..9bd964e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2014-11-26 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/63788
+ * asan.c (initialize_sanitizer_builtins): Add BT_FN_SIZE_CONST_PTR_INT
+ var. Conditionally build BUILT_IN_OBJECT_SIZE decl.
+ (ATTR_PURE_NOTHROW_LEAF_LIST): Define.
+
2014-11-26 Ilya Enkovich <ilya.enkovich@intel.com>
PR lto/64075
diff --git a/gcc/asan.c b/gcc/asan.c
index be28ede..90118b8 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2295,6 +2295,9 @@ initialize_sanitizer_builtins (void)
pointer_sized_int_node, NULL_TREE);
tree BT_FN_VOID_INT
= build_function_type_list (void_type_node, integer_type_node, NULL_TREE);
+ tree BT_FN_SIZE_CONST_PTR_INT
+ = build_function_type_list (size_type_node, const_ptr_type_node,
+ integer_type_node, NULL_TREE);
tree BT_FN_BOOL_VPTR_PTR_IX_INT_INT[5];
tree BT_FN_IX_CONST_VPTR_INT[5];
tree BT_FN_IX_VPTR_IX_INT[5];
@@ -2366,6 +2369,8 @@ initialize_sanitizer_builtins (void)
#undef ATTR_COLD_CONST_NORETURN_NOTHROW_LEAF_LIST
#define ATTR_COLD_CONST_NORETURN_NOTHROW_LEAF_LIST \
/* ECF_COLD missing */ ATTR_CONST_NORETURN_NOTHROW_LEAF_LIST
+#undef ATTR_PURE_NOTHROW_LEAF_LIST
+#define ATTR_PURE_NOTHROW_LEAF_LIST ECF_PURE | ATTR_NOTHROW_LEAF_LIST
#undef DEF_SANITIZER_BUILTIN
#define DEF_SANITIZER_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
decl = add_builtin_function ("__builtin_" NAME, TYPE, ENUM, \
@@ -2375,6 +2380,15 @@ initialize_sanitizer_builtins (void)
#include "sanitizer.def"
+ /* -fsanitize=object-size uses __builtin_object_size, but that might
+ not be available for e.g. Fortran at this point. We use
+ DEF_SANITIZER_BUILTIN here only as a convenience macro. */
+ if ((flag_sanitize & SANITIZE_OBJECT_SIZE)
+ && !builtin_decl_implicit_p (BUILT_IN_OBJECT_SIZE))
+ DEF_SANITIZER_BUILTIN (BUILT_IN_OBJECT_SIZE, "object_size",
+ BT_FN_SIZE_CONST_PTR_INT,
+ ATTR_PURE_NOTHROW_LEAF_LIST)
+
#undef DEF_SANITIZER_BUILTIN
}