https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85063
Bug ID: 85063 Summary: Switch conversion in openacc routine introduces unsupported construct Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vries at gcc dot gnu.org Target Milestone: --- Consider this test-case (filed earlier at lto PR84592): ... /* { dg-additional-options "-ftree-switch-conversion" } */ #include <stdio.h> #pragma acc routine seq static int __attribute__((noinline)) foo (int n) { switch (n & 3) { case 0: return 4; case 1: return 3; case 2: return 2; default: return 1; } } int main (void) { int n[1]; n[0] = 4; #pragma acc parallel copy(n) { n[0] = foo (n[0]); } printf ("n: %d\n", n[0]); return 0; } ... When compiling this at -O2, we run into an ICE in lto1. Switch conversion triggers for this example, which introduces a function static var, and the ICE happens when processing the function static var (which is what PR84592 is about). However, OpenACC forbids function static vars in routines. So, switch conversion shouldn't run on OpenACC routines.