https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118080
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Harald Anlauf <anl...@gcc.gnu.org>: https://gcc.gnu.org/g:8859dce9037bcb242819305f02e16edbea38923c commit r15-7570-g8859dce9037bcb242819305f02e16edbea38923c Author: Harald Anlauf <anl...@gmx.de> Date: Sat Feb 15 20:36:15 2025 +0100 Fortran: passing of derived type to VALUE,OPTIONAL dummy argument [PR118080] For scalar OPTIONAL dummy arguments with the VALUE attribute, gfortran passes a hidden flag to denote presence or absence of the actual argument for intrinsic types. Extend this treatment to derived type (user-defined as well as from intrinsic module ISO_C_BINDING). PR fortran/118080 gcc/fortran/ChangeLog: * gfortran.texi: Adjust documentation. * trans-decl.cc (create_function_arglist): Adjust to pass hidden presence flag also for derived type dummies with VALUE,OPTIONAL attribute. * trans-expr.cc (gfc_conv_expr_present): Expect hidden presence flag also for derived type dummies with VALUE,OPTIONAL attribute. (conv_cond_temp): Adjust to allow derived types. (conv_dummy_value): Extend to handle derived type dummies with VALUE,OPTIONAL attribute. (gfc_conv_procedure_call): Adjust for actual arguments passed to derived type dummies with VALUE,OPTIONAL attribute. * trans-types.cc (gfc_get_function_type): Adjust fndecl for hidden presence flag. gcc/testsuite/ChangeLog: * gfortran.dg/value_optional_2.f90: New test.