[PATCH] Fix PR78363
Jakub Jelinek
jakub@redhat.com
Wed Jan 25 09:18:00 GMT 2017
On Wed, Jan 25, 2017 at 09:52:41AM +0100, Richard Biener wrote:
> 2017-01-25 Richard Biener <rguenther@suse.de>
>
> PR debug/78363
> * omp-expand.c: Include debug.h.
> (expand_omp_taskreg): Make sure to generate early debug before
> outlining anything from a function.
> (expand_omp_target): Likewise.
> (grid_expand_target_grid_body): Likewise.
>
> * g++.dg/gomp/pr78363-1.C: New testcase.
> * g++.dg/gomp/pr78363-2.C: Likewise.
> * g++.dg/gomp/pr78363-3.C: Likewise.
Ok, with minor nit:
> --- gcc/testsuite/g++.dg/gomp/pr78363-1.C (nonexistent)
> +++ gcc/testsuite/g++.dg/gomp/pr78363-1.C (working copy)
> @@ -0,0 +1,14 @@
> +// { dg-do compile }
> +// { dg-require-effective-target c++11 }
> +// { dg-options "-g -fopenmp" }
> +
> +int main()
> +{
> + int n = 0;
> +
> +#pragma omp parallel for reduction (+: n)
> + for (int i = [](){ return 3; }(); i < 10; ++i)
> + n++;
> +
> + return n;
> +}
> Index: gcc/testsuite/g++.dg/gomp/pr78363-2.C
> ===================================================================
> --- gcc/testsuite/g++.dg/gomp/pr78363-2.C (nonexistent)
> +++ gcc/testsuite/g++.dg/gomp/pr78363-2.C (working copy)
> @@ -0,0 +1,15 @@
> +// { dg-do compile }
> +// { dg-require-effective-target c++11 }
> +// { dg-options "-g -fopenmp" }
Please replace dg-options with:
// { dg-additional-options "-g" }
-fopenmp -Wno-hsa is the default, while dg-options of -g -fopenmp
overrides that and -Wno-hsa would be lost. While it doesn't matter
in the first and last testcase (no offloading in those), on this one
I bet -Whsa (on by default) will warn if gcc is configured with hsa
offloading, because it is not gridifiable.
> +
> +int main()
> +{
> + int n = 0;
> +#pragma omp target map(tofrom:n)
> +#pragma omp for reduction (+: n)
> + for (int i = [](){ return 3; }(); i < 10; ++i)
> + n++;
> + if (n != 7)
> + __builtin_abort ();
> + return 0;
> +}
> Index: gcc/testsuite/g++.dg/gomp/pr78363-3.C
> ===================================================================
> --- gcc/testsuite/g++.dg/gomp/pr78363-3.C (nonexistent)
> +++ gcc/testsuite/g++.dg/gomp/pr78363-3.C (working copy)
> @@ -0,0 +1,14 @@
> +// { dg-do compile }
> +// { dg-require-effective-target c++11 }
> +// { dg-options "-g -fopenmp" }
> +
> +int main()
> +{
> + int n = 0;
> +#pragma omp task shared (n)
> + for (int i = [](){ return 3; }(); i < 10; ++i)
> + n = i;
> +#pragma omp taskwait
> + if (n != 7)
> + __builtin_abort ();
> +}
Jakub
More information about the Gcc-patches
mailing list