[PATCH, CHKP, i386, PR target/65184] Fix pass_by_reference for MS ABI for bounds
Ilya Enkovich
enkovich.gnu@gmail.com
Mon Mar 2 10:48:00 GMT 2015
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 ();
> +}
More information about the Gcc-patches
mailing list