[Bug c++/102640] New: [11/12 Regression] omp declare target to on C++ block scope extern declarations since r11-3699

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Oct 7 14:56:35 GMT 2021


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

            Bug ID: 102640
           Summary: [11/12 Regression] omp declare target to on C++ block
                    scope extern declarations since r11-3699
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

Since r11-3699-g4e62aca0e0520e4ed2532f2d8153581190621c1a
the following testcase misbehaves in C++, previously var1, var2, var3 were
correctly mapped (with no copying, as they are declare target to), since that
change it is instead firstprivatized:
/* { dg-do compile } */
/* { dg-additional-options "-fdump-tree-omplower" } */
/* Verify var[123] are mapped without any copying, because they are
   mentioned in declare target directive to clauses.  */
/* { dg-final { scan-tree-dump-not ".omp_data_arr.\[0-9]*.var" "omplower" } }
*/
/* { dg-final { scan-tree-dump-not ".omp_data_i->var" "omplower" } } */

void
foo (void)
{
  extern int var1;
  #pragma omp declare target to (var1)

  #pragma omp target
  var1++;
}

int
bar (int x)
{
  extern int var2;
  #pragma omp declare target to (var2)
  if (x)
    return var2;
  #pragma omp target
  var2++;
  return -1;
}
#pragma omp declare target to (bar)

#pragma omp declare target
int
baz (int x)
{
  extern int var3;
  if (x)
    return var3;
  #pragma omp target
  var3++;
  return -1;
}
#pragma omp end declare target


More information about the Gcc-bugs mailing list