[Bug middle-end/104563] [OpenMP] ICE in install_var_field, at omp-low.cc:810 (multi map of same var)

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 17 17:02:07 GMT 2022


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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Trying the hopefully matching rewrite of the test into C/C++:
void
foo (void)
{
  int x, scalar;
  int a[10];
  struct S { int var; int b[10]; } test_struct;
  int i;
  test_struct.var = 1;
  for (i = 0; i < 10; i++)
    {
      a[i] = 42;
      test_struct.b[i] = 42;
    }
  scalar = 80;
  #pragma omp target map(alloc: scalar, a, test_struct) map(to: scalar, a,
test_struct)
  if (scalar != 80 || a[1] != 42 || test_struct.var != 1 || test_struct.b[1] !=
42)
    __builtin_abort ();
}
is right now rejected by GCC:
pr104563.c: In function ‘void foo()’:
pr104563.c:15:44: error: ‘test_struct’ appears more than once in map clauses
   15 |   #pragma omp target map(alloc: scalar, a, test_struct) map(to: scalar,
a, test_struct)
      |                                            ^~~~~~~~~~~
pr104563.c:15:41: error: ‘a’ appears more than once in map clauses
   15 |   #pragma omp target map(alloc: scalar, a, test_struct) map(to: scalar,
a, test_struct)
      |                                         ^
pr104563.c:15:33: error: ‘scalar’ appears more than once in map clauses
   15 |   #pragma omp target map(alloc: scalar, a, test_struct) map(to: scalar,
a, test_struct)
      |                                 ^~~~~~
I agree it is invalid OpenMP 4.5, valid in OpenMP 5.0.
But as we clearly don't support it for C/C++, IMHO we shouldn't support it for
Fortran either,
especially when the support in the middle-end for it isn't there yet (otherwise
it wouldn't ICE).


More information about the Gcc-bugs mailing list