So, if I try to sum up what has been gathered in this thread:
- pr104131.f90 is invalid, as x is not scalar.
Checks are better done in resolve_omp_clauses after a call
to gfc_resolve_expr.
Checking expr->sym->attr.dimension seems to cover more cases than
expr->rank > 0.
- pr104131-2.f90 is valid and should be accepted.
- Some other cases should be rejected, including x[1] (coindexed
variable), x(1) (array element), x%comp (structure component).
Is that correct? Anything else?
Regarding the expr->rank vs expr->sym->attr.dimension controversy, my
take is that it should stick to the error message. Use expr->rank is
the error is about scalar vs array, use expr->sym->attr.dimension if
it’s about subobject-ness of an array variable.
Coming back to the PR, the ICE backtraces for pr104131.f90 and
pr104131-2.f90 are different and should probably be treated separatedly.
I don’t know how difficult the bullet 2 above would be, but bullet 1 and
3 seem quite doable.