https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63158
Bug ID: 63158
Summary: Possible wrong code with absend optional BT_CLASS ->
optional BT_DERIVED dummy argument
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Follow up to PR 62270 comment 3.
The following code adds conditionally a check whether a var == NULL check
should be added. I fear that some extra check for BT_CLASS might be needed,
e.g. when passing a BT_CLASS optional argument to a BT_DERIVED optional
argument (same declared type). Namely, in the case the actual argument is NULL.
trans-expr.c:gfc_conv_procedure_call
4445 if (fsym->attr.optional
4446 && e->expr_type == EXPR_VARIABLE
4447 && (!e->ref
4448 || (e->ref->type == REF_ARRAY
4449 && !e->ref->u.ar.type != AR_FULL))