re PR middle-end/66567 ([CHKP] internal compiler error: in assign_parms)
authorIlya Enkovich <enkovich.gnu@gmail.com>
Thu, 18 Jun 2015 10:09:22 +0000 (10:09 +0000)
committerIlya Enkovich <ienkovich@gcc.gnu.org>
Thu, 18 Jun 2015 10:09:22 +0000 (10:09 +0000)
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.

From-SVN: r224600

gcc/ChangeLog
gcc/ipa-chkp.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/mpx/pr66567.c [new file with mode: 0644]
gcc/tree-chkp.c

index 22b3325fffff1f98935730148f456d3fba65d4e5..335ec7dbddce5f4565b05b1e34976b7d7741c00c 100644 (file)
@@ -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
index 181be9b964897f3bcbfefc47445c6cd4d67805a4..96f269cd0a936b7b4b10df2db270c90bb001639b 100644 (file)
@@ -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
index 80727d1620c8e3a58ac607b09f73ed88c6f8a565..95107ae6681c04bb02eddacce5f3078a6cd0a57f 100644 (file)
@@ -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 (file)
index 0000000..5a7e2f2
--- /dev/null
@@ -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;
+}
index bee63cd013b8744da83f47aa31f281559204e477..ed734e649c4062d7ffe0732223926c99cc1a277e 100644 (file)
@@ -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.  */