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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
It seems as if - at least for the warning - the problem is the following
(.count.11 not initialized); that's for comment 2 with
  !$omp target teams distribute simd collapse(3)


  .iter.10 = 0;
  if (1 < D.4902)
    goto <bb 32>; [99.95%]
  else
    goto <bb 16>; [0.05%]
...
  <bb 16> :
  if (.iter.10 == .count.11)
    goto <bb 17>; [INV]
...

  <bb 17> :
  D.4904 = .omp_data_i->k;
  *D.4904 = k;
...
  <bb 32> :
  .count.20 = (unsigned int) D.4898;
  .count.11 = .count.20;

  <bb 13> :
  D.4952 = .GOMP_SIMD_LAST_LANE (simduid.9, D.4929);

* * *

Using the following patch [mostly untested] – which seems to be at least
sensible for '==' - silences the '.count' warnings in SPECaccel's 455.seismic
and 455.seismic.

BUT: It does not solve the runtime issue with nvptx offload, which might (or
might not) be unrelated.

--- a/gcc/omp-low.cc
+++ b/gcc/omp-low.cc
@@ -10569,6 +10571,8 @@ lower_omp_for_lastprivate (struct omp_for_data *fd,
gimple_seq *body_p,
       /* Initialize the iterator variable, so that threads that don't execute
         any iterations don't execute the lastprivate clauses by accident.  */
       gimplify_assign (fd->loop.v, vinit, body_p);
+      if (DECL_P (fd->loop.n2))
+       gimplify_assign (fd->loop.n2, vinit, body_p);
     }
 }

Reply via email to