aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorienkovich <ienkovich@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-18 10:09:22 +0000
committerienkovich <ienkovich@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-18 10:09:22 +0000
commit391cf42b668f79f2c0dc58fb9314a179048f580b (patch)
treeeba0ce1deaf12130f58e3a564eb43633841f6f11
parentfc0fe623c9ea9dbf572d940113b7823f97d9f0d0 (diff)
gcc/
PR middle-end/66567 * ipa-chkp.c (chkp_maybe_create_clone): Require functions to be instrumentable. * tree-chkp.c (chkp_replace_function_pointer): Use chkp_instrumentable_p instead of attribute check. gcc/testsuite/ PR middle-end/66567 * gcc.target/i386/mpx/pr66567.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224600 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/ipa-chkp.c23
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/pr66567.c16
-rw-r--r--gcc/tree-chkp.c2
5 files changed, 34 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 22b3325ffff..335ec7dbddc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2015-06-18 Ilya Enkovich <enkovich.gnu@gmail.com>
+
+ PR middle-end/66567
+ * ipa-chkp.c (chkp_maybe_create_clone): Require
+ functions to be instrumentable.
+ * tree-chkp.c (chkp_replace_function_pointer): Use
+ chkp_instrumentable_p instead of attribute check.
+
2015-06-18 Richard Biener <rguenther@suse.de>
PR tree-optimization/66510
diff --git a/gcc/ipa-chkp.c b/gcc/ipa-chkp.c
index 181be9b9648..96f269cd0a9 100644
--- a/gcc/ipa-chkp.c
+++ b/gcc/ipa-chkp.c
@@ -563,25 +563,10 @@ chkp_maybe_create_clone (tree fndecl)
if (gimple_has_body_p (fndecl))
{
- /* If function will not be instrumented, then it's instrumented
- version is a thunk for the original. */
- if (!chkp_instrumentable_p (fndecl))
- {
- clone->remove_callees ();
- clone->remove_all_references ();
- clone->thunk.thunk_p = true;
- clone->thunk.add_pointer_bounds_args = true;
- clone->create_edge (node, NULL, 0, CGRAPH_FREQ_BASE);
- /* Thunk shouldn't be a cdtor. */
- DECL_STATIC_CONSTRUCTOR (clone->decl) = 0;
- DECL_STATIC_DESTRUCTOR (clone->decl) = 0;
- }
- else
- {
- tree_function_versioning (fndecl, new_decl, NULL, false,
- NULL, false, NULL, NULL);
- clone->lowered = true;
- }
+ gcc_assert (chkp_instrumentable_p (fndecl));
+ tree_function_versioning (fndecl, new_decl, NULL, false,
+ NULL, false, NULL, NULL);
+ clone->lowered = true;
}
/* New params are inserted after versioning because it
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 80727d1620c..95107ae6681 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-18 Ilya Enkovich <enkovich.gnu@gmail.com>
+
+ PR middle-end/66567
+ * gcc.target/i386/mpx/pr66567.c: New test.
+
2015-06-18 Richard Biener <rguenther@suse.de>
PR tree-optimization/66510
diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr66567.c b/gcc/testsuite/gcc.target/i386/mpx/pr66567.c
new file mode 100644
index 00000000000..5a7e2f29e80
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/pr66567.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx" } */
+
+void (*b) ();
+
+void fn1 (const int *p1)
+{
+ static void *a = &&conv_1234_123C;
+ conv_1234_123C:
+ ;
+}
+
+void fn2 ()
+{
+ b = fn1;
+}
diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c
index bee63cd013b..ed734e649c4 100644
--- a/gcc/tree-chkp.c
+++ b/gcc/tree-chkp.c
@@ -4088,7 +4088,7 @@ chkp_replace_function_pointer (tree *op, int *walk_subtrees,
void *data ATTRIBUTE_UNUSED)
{
if (TREE_CODE (*op) == FUNCTION_DECL
- && !lookup_attribute ("bnd_legacy", DECL_ATTRIBUTES (*op))
+ && chkp_instrumentable_p (*op)
&& (DECL_BUILT_IN_CLASS (*op) == NOT_BUILT_IN
/* For builtins we replace pointers only for selected
function and functions having definitions. */