[PATCH] OpenACC use_device clause ICE fix

Jakub Jelinek jakub@redhat.com
Mon Jan 25 10:02:00 GMT 2016


On Mon, Jan 25, 2016 at 10:58:17AM +0100, Jakub Jelinek wrote:
> --- gcc/testsuite/c-c++-common/goacc/use_device-1.c.jj	2016-01-25 10:56:33.472310437 +0100
> +++ gcc/testsuite/c-c++-common/goacc/use_device-1.c	2016-01-25 10:56:43.128176481 +0100
> @@ -0,0 +1,15 @@
> +/* { dg-do compile } */
> +
> +void
> +foo (float *x, float *y)
> +{
> +  int n = 1 << 20;
> +#pragma acc data create(x[0:n]) copyout(y[0:n])
> +  {
> +#pragma acc host_data use_device(x,y)
> +    {
> +      for (int i = 1; i < n; i++)
> +	y[0] += x[i] * y[i];
> +    }
> +  }
> +}

Though the testcase looks invalid to me, how can you dereference
the device pointer on the host?  Though, for a testcase that it doesn't ICE
maybe good enough.

	Jakub



More information about the Gcc-patches mailing list