https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92113
--- Comment #7 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- I had thought that this patch Index: trans-decl.c =================================================================== --- trans-decl.c (Revision 277486) +++ trans-decl.c (Arbeitskopie) @@ -1911,14 +1911,6 @@ if (sym->attr.associate_var) GFC_DECL_ASSOCIATE_VAR_P (decl) = 1; - /* We no longer mark __def_init as read-only so it does not take up - space in the read-only section and dan go into the BSS instead, - see PR 84487. Marking this as artificial means that OpenMP will - treat this as predetermined shared. */ - if (sym->attr.vtab - || (sym->name[0] == '_' && gfc_str_startswith (sym->name, "__def_init"))) - DECL_ARTIFICIAL (decl) = 1; - return decl; } Index: trans-openmp.c =================================================================== --- trans-openmp.c (Revision 277486) +++ trans-openmp.c (Arbeitskopie) @@ -119,11 +119,24 @@ enum omp_clause_default_kind gfc_omp_predetermined_sharing (tree decl) { + const char *name; + name = IDENTIFIER_POINTER (DECL_NAME (decl)); + + /* These variables are artificial, and need to be shared for OpenMP. + See PR 84487 and PR 92113. */ + + if (name[0] == '_') + { + if (gfc_str_startswith (name, "__vtab") || strstr (name, "__def_init")) + return OMP_CLAUSE_DEFAULT_SHARED; + } + /* Associate names preserve the association established during ASSOCIATE. As they are implemented either as pointers to the selector or array descriptor and shouldn't really change in the ASSOCIATE region, this decl can be either shared or firstprivate. If it is a pointer, use firstprivate, as it is cheaper that way, otherwise make it shared. */ + if (GFC_DECL_ASSOCIATE_VAR_P (decl)) { if (TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE) would help, but apparently not - still segfaults on POWER. So, it seems that it is the absence of DECL_READONLY, and not the presence of DECL_ARTIFICIAL, that is the problem.