}
/* Check threadprivate restrictions. */
- if (sym->attr.threadprivate && !sym->attr.save
+ if (sym->attr.threadprivate
+ && !(sym->attr.save || sym->attr.data || sym->attr.in_common)
&& !(sym->ns->save_all && !sym->attr.automatic)
- && (!sym->attr.in_common
- && sym->module == NULL
- && (sym->ns->proc_name == NULL
- || sym->ns->proc_name->attr.flavor != FL_MODULE)))
+ && sym->module == NULL
+ && (sym->ns->proc_name == NULL
+ || sym->ns->proc_name->attr.flavor != FL_MODULE))
gfc_error ("Threadprivate at %L isn't SAVEd", &sym->declared_at);
/* Check omp declare target restrictions. */
--- /dev/null
+! PR fortran/99514
+!
+! NTest in DATA is implicitly SAVE, unless in COMMON
+! Was failing before as the implicit SAVE was not
+! honoured by the threadprivate check.
+!
+
+program main
+ DATA NTest /1/
+ !$omp threadprivate(Ntest)
+end program main