https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- >From quick look, seems the Fortran FE for the dummy optional argument uses array.0, i.e. a local automatic array descriptor that is assigned if if (array != 0B && (real(kind=4)[0:] * restrict) array->data != 0B) something at the start of the function. While most of the references to array are then replaced with accesses to array.0, the PRESENT check is done using the above condition. So, I guess we should tweak the FE so that for the optional dummy arguments in data sharing clauses it will add also firstprivate (array) or something similar (if the original PARM_DECL is only used in PRESENT checks, then firstprivate is all we need).