https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114825
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> --- The difference between the failing program and a working program (pointer-assignment in 'sub' comment out) is: failing: 'type' in gfc_omp_clause_default_ctor is '<record_type 0x7ffff7004930 t' working: 'type' is '<pointer_type 0x7ffff700a150 ... <record_type 0x7ffff7004930 t' (and 'outer' is NULL in either case) In the caller, i.e. lower_rec_input_clauses: working: p debug_tree(new_var) → <var_decl 0x7ffff720df30 d failing: p debug(new_var) → *d – i.e. with a memory dereference. The reason is that gfc_omp_privatize_by_reference returns true in the omp-low.cc's lower_rec_input_clauses call to it: 5737 else if (omp_privatize_by_reference (var) 5738 && (c_kind != OMP_CLAUSE_FIRSTPRIVATE 5739 || !OMP_CLAUSE_FIRSTPRIVATE_NO_REFERENCE (c))) The problem is that: /* Array POINTER/ALLOCATABLE have aggregate types, all user variables that have POINTER_TYPE type and aren't scalar pointers, scalar allocatables, Cray pointees or C pointers are supposed to be privatized by reference. */ if (GFC_DECL_GET_SCALAR_POINTER (decl) || GFC_DECL_GET_SCALAR_ALLOCATABLE (decl) || GFC_DECL_CRAY_POINTEE (decl) || GFC_DECL_ASSOCIATE_VAR_P (decl) || VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl)))) return false; fails in the failing case – but works in the non-failing case – IHMO, it should have matched the first item.