https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107236
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The problem seems to be that:
execute_omp_device_lower ()
...
tree lhs = gimple_call_lhs (stmt), rhs = NULL_TREE;
tree type = lhs ? TREE_TYPE (lhs) : integer_type_node;
switch (gimple_call_internal_fn (stmt))
{
case IFN_GOMP_TARGET_REV:
is never reached.
Thus, IFN_GOMP_TARGET_REV remains - and the assert that IFN_GOMP_TARGET_REV has
been removed fails, leading to the ICE.
It seems as if pass_omp_device_lower::gate(...) wrongly skips the generated
nested
function for parallel. The current check is:
return (!(fun->curr_properties & PROP_gimple_lomp_dev)
|| (flag_openmp
&& cgraph_node::get (fun->decl)->calls_declare_variant_alt));