public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, i386, PR target/66048] Fix mode switching ICE for functions returning bounds
@ 2015-05-12 10:12 Ilya Enkovich
  2015-05-12 11:13 ` Uros Bizjak
  2015-05-12 20:05 ` Jeff Law
  0 siblings, 2 replies; 3+ messages in thread
From: Ilya Enkovich @ 2015-05-12 10:12 UTC (permalink / raw)
  To: gcc-patches; +Cc: ubizjak

Hi,

This patch moves up use insns for returned bounds and also marks bnd1 register as holding return value.  This fixes problem in create_pre_exit for functions with no returned bounds initialization.  Bootstrapped and regtested for x86_64-unknown-linux-gnu.  Is it OK for trunk/gcc-5?

Thanks,
Ilya
--
gcc/

2015-05-12  Ilya Enkovich  <ilya.enkovich@intel.com>

	* function.c (diddle_return_value_1): Process bounds first.
	* config/i38/i386.c (ix86_function_value_regno_p): Add bnd1
	register.

gcc/testsuite/

2015-05-12  Ilya Enkovich  <ilya.enkovich@intel.com>

	* gcc.target/i386/mpx/pr66048.cc: New.


diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 7bd9ff3..869e064 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -8187,7 +8187,8 @@ ix86_function_value_regno_p (const unsigned int regno)
     case SI_REG:
       return TARGET_64BIT && ix86_abi != MS_ABI;
 
-    case FIRST_BND_REG:
+    case BND0_REG:
+    case BND1_REG:
       return chkp_function_instrumented_p (current_function_decl);
 
       /* Complex values are returned in %st(0)/%st(1) pair.  */
diff --git a/gcc/function.c b/gcc/function.c
index 4f4c461..c81ee4c 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5224,8 +5224,8 @@ diddle_return_value_1 (void (*doit) (rtx, void *), void *arg, rtx outgoing)
 void
 diddle_return_value (void (*doit) (rtx, void *), void *arg)
 {
-  diddle_return_value_1 (doit, arg, crtl->return_rtx);
   diddle_return_value_1 (doit, arg, crtl->return_bnd);
+  diddle_return_value_1 (doit, arg, crtl->return_rtx);
 }
 
 static void
diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr66048.cc b/gcc/testsuite/gcc.target/i386/mpx/pr66048.cc
new file mode 100644
index 0000000..b29cd03
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/pr66048.cc
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcheck-pointer-bounds -mmpx -march=corei7-avx" } */
+
+struct c1
+{
+  c1 (const c1 &other) : p (other.p) { };
+  int *p;
+};
+
+struct c2 : public c1 { };
+
+c1
+test (c2 a)
+{
+  return a;
+}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, i386, PR target/66048] Fix mode switching ICE for functions returning bounds
  2015-05-12 10:12 [PATCH, i386, PR target/66048] Fix mode switching ICE for functions returning bounds Ilya Enkovich
@ 2015-05-12 11:13 ` Uros Bizjak
  2015-05-12 20:05 ` Jeff Law
  1 sibling, 0 replies; 3+ messages in thread
From: Uros Bizjak @ 2015-05-12 11:13 UTC (permalink / raw)
  To: Ilya Enkovich; +Cc: gcc-patches

On Tue, May 12, 2015 at 12:07 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:

> This patch moves up use insns for returned bounds and also marks bnd1 register as holding return value.  This fixes problem in create_pre_exit for functions with no returned bounds initialization.  Bootstrapped and regtested for x86_64-unknown-linux-gnu.  Is it OK for trunk/gcc-5?
>
> 2015-05-12  Ilya Enkovich  <ilya.enkovich@intel.com>
>
>         * function.c (diddle_return_value_1): Process bounds first.
>         * config/i38/i386.c (ix86_function_value_regno_p): Add bnd1
>         register.
>
> gcc/testsuite/
>
> 2015-05-12  Ilya Enkovich  <ilya.enkovich@intel.com>
>
>         * gcc.target/i386/mpx/pr66048.cc: New.

x86 part is OK.

Thanks,
Uros.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, i386, PR target/66048] Fix mode switching ICE for functions returning bounds
  2015-05-12 10:12 [PATCH, i386, PR target/66048] Fix mode switching ICE for functions returning bounds Ilya Enkovich
  2015-05-12 11:13 ` Uros Bizjak
@ 2015-05-12 20:05 ` Jeff Law
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Law @ 2015-05-12 20:05 UTC (permalink / raw)
  To: Ilya Enkovich, gcc-patches; +Cc: ubizjak

On 05/12/2015 04:07 AM, Ilya Enkovich wrote:
> Hi,
>
> This patch moves up use insns for returned bounds and also marks bnd1 register as holding return value.  This fixes problem in create_pre_exit for functions with no returned bounds initialization.  Bootstrapped and regtested for x86_64-unknown-linux-gnu.  Is it OK for trunk/gcc-5?
>
> Thanks,
> Ilya
> --
> gcc/
>
> 2015-05-12  Ilya Enkovich  <ilya.enkovich@intel.com>
>
> 	* function.c (diddle_return_value_1): Process bounds first.
> 	* config/i38/i386.c (ix86_function_value_regno_p): Add bnd1
> 	register.
>
> gcc/testsuite/
>
> 2015-05-12  Ilya Enkovich  <ilya.enkovich@intel.com>
>
> 	* gcc.target/i386/mpx/pr66048.cc: New.
OK for the trunk.  Release managers have the final say on the branches, 
but looks pretty safe to me.

jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-12 20:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-12 10:12 [PATCH, i386, PR target/66048] Fix mode switching ICE for functions returning bounds Ilya Enkovich
2015-05-12 11:13 ` Uros Bizjak
2015-05-12 20:05 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).