https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102596
Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org Keywords| |ice-on-valid-code --- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> --- The problem is that gfc_omp_clause_default_ctor requires outer != NULL_TREE (gcc_assert). (C++ does ignore the last argument and C uses the hook_tree_tree_tree_tree_null fallback.) That is used in Fortran for: /* Allocatable arrays and scalars in PRIVATE clauses need to be set to "not currently allocated" allocation status if outer array is "not currently allocated", otherwise should be allocated. */ But omp-low.cc has: x = lang_hooks.decls.omp_clause_default_ctor (c, unshare_expr (new_var), cond ? NULL_TREE : build_outer_var_ref (var, ctx)); Note the NULL_TREE. My impression is that NULL_TREE is fine for reduction - and there is also code like: /* Reduction clause requires allocated ALLOCATABLE. */ if (OMP_CLAUSE_CODE (clause) != OMP_CLAUSE_REDUCTION && OMP_CLAUSE_CODE (clause) != OMP_CLAUSE_IN_REDUCTION && OMP_CLAUSE_CODE (clause) != OMP_CLAUSE_TASK_REDUCTION) { gfc_init_block (&cond_block); ... tree tem = fold_convert (pvoid_type_node, GFC_DESCRIPTOR_TYPE_P (type) ? gfc_conv_descriptor_data_get (outer) : outer);/*...*/ cond = fold_build2_loc (input_location, NE_EXPR, logical_type_node, tem, null_pointer_node); However - there is other code which uses 'outer' like: tree tem = gfc_walk_alloc_comps (outer, decl, or gfc_add_modify (&cond_block, decl, outer); and those make use of 'outer'. I don't quickly see whether outer is always required or it can be deduced in this case. (Does using OMP_CLAUSE_REDUCTION_PLACEHOLDER() make sense here?) — Or whether some is-always-used case (→ 'cond' case) is needed as additional flag or encoded in outer. PS: I don't think it is a real regression as 'reduction(task:' wasn't supported before.