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

Alex <waffl3x at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Offloading vs. C++          |Offloading vs. C++
                   |'std::valarray'             |'std::initializer_list'
                 CC|                            |waffl3x at gcc dot gnu.org

--- Comment #3 from Alex <waffl3x at gcc dot gnu.org> ---
This appears to be related to std::initializer_list
```
#include <initializer_list>

bool initializer_list()
{
  int sum;
  #pragma omp target map(from: sum)
    {
      auto il = {0, 1, 2, 3, 4, 5};
      int n = 0;
      auto end = il.end();
      for (auto it = il.begin(); it != end; ++it)
        n += *it;
      sum = n;
    }
  return sum == 15;
}

int main()
{
  return initializer_list() ? 0 : 1;
}
```
I'm sure a better reduced case exists, seems specifically be reading the
elements of the list as the following passes.
```
/* std::initializer_list in target region.  */

#include <initializer_list>

bool initializer_list()
{
  bool ok;
  #pragma omp target map(from: ok)
    {
      auto il = {0, 1, 2, 3, 4, 5};
      ok = il.begin() != il.end();
    }
  return ok;
}

int main()
{
  return initializer_list() ? 0 : 1;
}
```

Reply via email to