https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118080

--- Comment #1 from anlauf at gcc dot gnu.org ---
(In reply to Tobias Burnus from comment #0)
> It is unsurprising that this fails because trans-expr.cc has:
> 
> static void
> conv_dummy_value (gfc_se * parmse, gfc_expr * e, gfc_symbol * fsym,
>                   vec<tree, va_gc> *& optionalargs)
> {         
> ...
>   if (fsym->attr.optional
>       && fsym->ts.type != BT_CLASS
>       && fsym->ts.type != BT_DERIVED)
>     {
> ...
>     }
> }
> 
> 
> 
> Ignoring the question why fsym changes its type, the question is:
>   Why is BT_DERIVED not handled?
> 
> TYPE(T) with VALUE and OPTIONAL seems to be perfectly valid in Fortran
> 2003/2008/2018/2023.

CLASS and DT were excepted because IMO there is no clear existing definition
how to handle these.  I think that for anything beyond the scalar basic types
we need to explicitly create temporaries for dummies with the VALUE attribute.
The hidden argument is not needed then, as passing a NULL pointer for a
missing argument would work the same way as for non-value dummies.
Or is there a reason to keep the kludge with the hidden argument?

Note that we also do not yet handle arrays of the basic types with the VALUE
attribute.

See also pr92702, pr92703, pr102369, pr110290.

Reply via email to