public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, CHKP, i386, PR target/65184] Fix pass_by_reference for MS ABI for bounds
@ 2015-02-25 14:41 Ilya Enkovich
  2015-03-02 10:48 ` Ilya Enkovich
  0 siblings, 1 reply; 2+ messages in thread
From: Ilya Enkovich @ 2015-02-25 14:41 UTC (permalink / raw)
  To: gcc-patches

Hi,

Currenly ix86_pass_by_reference may return 1 for bounds if MS ABI is used.  This patch explicitly says bounds are never passed by reference.  Bootstrapped and tested on x86_64-unknown-linux-gnu.  OK for trunk?


Thanks,
Ilya
--
gcc/

2015-02-25  Ilya Enkovich  <ilya.enkovich@intel.com>

	PR target/65184
	* gcc/config/i386/i386.c (ix86_pass_by_reference) Bounds
	are never passed by reference.

gcc/testsuite/

2015-02-25  Ilya Enkovich  <ilya.enkovich@intel.com>

	PR target/65184
	* gcc.target/i386/pr65184.c: New.


diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 71a5b22..28242d7 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -7859,6 +7859,11 @@ ix86_pass_by_reference (cumulative_args_t cum_v, machine_mode mode,
 {
   CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
 
+  /* Bounds are never passed by reference.  */
+  if ((type && POINTER_BOUNDS_TYPE_P (type))
+      || POINTER_BOUNDS_MODE_P (mode))
+    return false;
+
   /* See Windows x64 Software Convention.  */
   if (TARGET_64BIT && (cum ? cum->call_abi : ix86_abi) == MS_ABI)
     {
diff --git a/gcc/testsuite/gcc.target/i386/pr65184.c b/gcc/testsuite/gcc.target/i386/pr65184.c
new file mode 100644
index 0000000..0355f29
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr65184.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target mpx } */
+/* { dg-options "-O2 -mabi=ms -fcheck-pointer-bounds -mmpx" } */
+
+void
+foo (int *a)
+{
+  if (a[0] != a[1] * 2333)
+    __builtin_abort ();
+}
+
+void
+bar (int *a)
+{
+  if (a[0] != a[1] * 2333)
+    __builtin_abort ();
+}

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

* Re: [PATCH, CHKP, i386, PR target/65184] Fix pass_by_reference for MS ABI for bounds
  2015-02-25 14:41 [PATCH, CHKP, i386, PR target/65184] Fix pass_by_reference for MS ABI for bounds Ilya Enkovich
@ 2015-03-02 10:48 ` Ilya Enkovich
  0 siblings, 0 replies; 2+ messages in thread
From: Ilya Enkovich @ 2015-03-02 10:48 UTC (permalink / raw)
  To: gcc-patches

Committed to trunk.

2015-02-25 17:25 GMT+03:00 Ilya Enkovich <enkovich.gnu@gmail.com>:
> Hi,
>
> Currenly ix86_pass_by_reference may return 1 for bounds if MS ABI is used.  This patch explicitly says bounds are never passed by reference.  Bootstrapped and tested on x86_64-unknown-linux-gnu.  OK for trunk?
>
>
> Thanks,
> Ilya
> --
> gcc/
>
> 2015-02-25  Ilya Enkovich  <ilya.enkovich@intel.com>
>
>         PR target/65184
>         * gcc/config/i386/i386.c (ix86_pass_by_reference) Bounds
>         are never passed by reference.
>
> gcc/testsuite/
>
> 2015-02-25  Ilya Enkovich  <ilya.enkovich@intel.com>
>
>         PR target/65184
>         * gcc.target/i386/pr65184.c: New.
>
>
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index 71a5b22..28242d7 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -7859,6 +7859,11 @@ ix86_pass_by_reference (cumulative_args_t cum_v, machine_mode mode,
>  {
>    CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
>
> +  /* Bounds are never passed by reference.  */
> +  if ((type && POINTER_BOUNDS_TYPE_P (type))
> +      || POINTER_BOUNDS_MODE_P (mode))
> +    return false;
> +
>    /* See Windows x64 Software Convention.  */
>    if (TARGET_64BIT && (cum ? cum->call_abi : ix86_abi) == MS_ABI)
>      {
> diff --git a/gcc/testsuite/gcc.target/i386/pr65184.c b/gcc/testsuite/gcc.target/i386/pr65184.c
> new file mode 100644
> index 0000000..0355f29
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/pr65184.c
> @@ -0,0 +1,17 @@
> +/* { dg-do compile } */
> +/* { dg-require-effective-target mpx } */
> +/* { dg-options "-O2 -mabi=ms -fcheck-pointer-bounds -mmpx" } */
> +
> +void
> +foo (int *a)
> +{
> +  if (a[0] != a[1] * 2333)
> +    __builtin_abort ();
> +}
> +
> +void
> +bar (int *a)
> +{
> +  if (a[0] != a[1] * 2333)
> +    __builtin_abort ();
> +}

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

end of thread, other threads:[~2015-03-02 10:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-25 14:41 [PATCH, CHKP, i386, PR target/65184] Fix pass_by_reference for MS ABI for bounds Ilya Enkovich
2015-03-02 10:48 ` Ilya Enkovich

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).