https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108422

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Created attachment 54491
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54491&action=edit
Testcase - compile with 'g++ -fopenmp' + run

(In reply to Tobias Burnus from comment #3)
> --- a/gcc/gimplify.cc
> +++ b/gcc/gimplify.cc
> @@ -9643 +9643 @@ omp_tsort_mapping_groups_1 (omp_mapping_group ***outlist,
> -      if (innerp && *innerp != grp)
> +      if (innerp && *innerp != grp && (*innerp)->mark != PERMANENT)

While COMPILING WORKS and the expected nested-target warning is printed,
it FAILS at RUNTIME (on a system not configured for offloading) with a
segfault.

That's related to the warning:
  test.cc:20:13: warning: '__closure' is used uninitialized [-Wuninitialized]
which appears at the location of the outer 'omp target (parallel)'.


Note: without inner target construct (reverse offload), the program runs fine.
(Independent of the one-line patch.)

Reply via email to