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

            Bug ID: 84992
           Summary: [openacc] function static var in parallel
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

When compiling this openacc testcase:
....
#include <stdio.h>

int
main (void)
{
  int n[1];
  n[0] = 3;
#pragma acc parallel copy(n)
  {
    static const int test[] = {1,2,3,4};
    n[0] = test[n[0]];
  }
  printf ("n: %d\n", n[0]);

  return 0;
}
...

we run into an ICE:
...
lto1: internal compiler error: in input_varpool_node, at lto-cgraph.c:1424^M
...

We've reported the ICE at PR84592, where we use a slightly more complicated
example.

But the first question here is: is this a valid openacc program?

Given that function static variables are not supported in functions to which a
routine directive applies, are function static variables supported in parallel
regions, or not?

If not, we should emit a proper error message.

If so, we should implement the required semantics.

Reply via email to