]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: passing of derived type to VALUE,OPTIONAL dummy argument [PR118080]
authorHarald Anlauf <anlauf@gmx.de>
Sat, 15 Feb 2025 19:36:15 +0000 (20:36 +0100)
committerHarald Anlauf <anlauf@gmx.de>
Sat, 22 Feb 2025 14:12:25 +0000 (15:12 +0100)
commit02eedd2932e4c91f41437f56c34eee1a128c24fb
tree9d35089fe241850f8b230f530b602933e9e105bc
parent68d50c95af648cb8b0709ce63285525dfb53d376
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.

(cherry picked from commit 8859dce9037bcb242819305f02e16edbea38923c)
gcc/fortran/gfortran.texi
gcc/fortran/trans-decl.cc
gcc/fortran/trans-expr.cc
gcc/fortran/trans-types.cc
gcc/testsuite/gfortran.dg/value_optional_2.f90 [new file with mode: 0644]