Hi Thomas, On 10/6/19 5:26 PM, Thomas Koenig wrote:
+/* Under certain conditions, a scalar actual argument can be passed + to an array dummy argument - see F2018, 15.5.2.4, clause 14. This + functin returns true for these conditions so that an error or
function ("o" missing); I think it is not clause 14 but paragraph 14.
+ warning for this can be suppressed later. */ + +bool +maybe_dummy_array_arg (gfc_expr *e) +{ + gfc_symbol *s; + + if (e->rank > 0) + return false; + + if (e->ts.type == BT_CHARACTER && e->ts.kind == 1) + return true; + + if (e->expr_type != EXPR_VARIABLE) + return false;
What about PARAMETER? :-)
+ s = e->symtree->n.sym; + if (s->as == NULL) + return false;
This looks wrong. You also want to permit dt%array(1) – but not dt(1)%scalar
+ if (s->ts.type == BT_CLASS || s->as->type == AS_ASSUMED_SHAPE + || s->attr.pointer) + return false;
dt%foo – again, "foo" can be an allocatable of polymorphic type or a pointer, but at least, it cannot be of assumed shape.
Otherwise it looks good at a glance. Tobias