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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[OpenMP][nvptx] (Con't)     |[OpenMP][nvptx, SIMT]
                   |Reduction fails with        |(Con't) Reduction fails
                   |optimization and            |with optimization and
                   |'loop'/'for simd' but not   |'loop'/'for simd' but not
                   |with 'for'                  |with 'for'

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
FTR, example minimized to:
...
// { dg-additional-options "-foffload=-latomic" }

#include <iostream>
#include <cstdlib>
#include <cmath>
#include <complex>

using std::complex;

#pragma omp declare reduction(+: complex<int>: omp_out += omp_in)

int
main (void)
{
  const int N0 { 32768 };
  const complex<int> expected_value { N0, 0 };
  complex<int> counter_N0 { 0, 0 };

#pragma omp target
#pragma omp for simd reduction(+: counter_N0)
  for (int i0 = 0 ; i0 < N0 ; i0++ )
    counter_N0 += complex<int> { 1, 0 };

  std::cerr << "Expected: " << expected_value  << std::endl;
  std::cerr << "Got     : " << counter_N0 << std::endl;

  return 0;
}
...

Reply via email to