https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116786
Bug ID: 116786 Summary: [OpenMP] ICE in install_var_field, at omp-low.cc:798 for C++ lambda Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: ice-on-valid-code, openmp Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org CC: jakub at gcc dot gnu.org Target Milestone: --- The following code fails to compile with: foo.cc: In function ‘int main()’: foo.cc:8:11: internal compiler error: in install_var_field, at omp-low.cc:798 8 | #pragma omp target map(lambda) | ^~~ 0x14f4ab9 internal_error(char const*, ...) ???:0 0x14f0750 fancy_abort(char const*, int, char const*) ???:0 0x1778cec walk_gimple_stmt(gimple_stmt_iterator*, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) ???:0 // NOTE: // The following will access 'x' directly not 'xref' // still, it should not ICE. int x; #pragma omp declare target(x) int main() { int& xref = x; auto lambda = [&xref]{xref = 5; }; #pragma omp target map(lambda) lambda(); #pragma target update from(x) __builtin_printf("%d\n", x); }