]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: fix passing of NULL() to assumed-rank, derived type dummy [PR104819]
authorHarald Anlauf <anlauf@gmx.de>
Sat, 14 Dec 2024 19:26:47 +0000 (20:26 +0100)
committerHarald Anlauf <anlauf@gmx.de>
Sat, 21 Dec 2024 19:30:56 +0000 (20:30 +0100)
commitd637e6d069ade775a4b61f51fff61fe4cce01c36
treee1d61d33bedabbb00ad0c83e3a153b6dec5d520a
parent145e462d557af537d90ef6da1391a57603c6fcf0
Fortran: fix passing of NULL() to assumed-rank, derived type dummy [PR104819]

PR fortran/104819

gcc/fortran/ChangeLog:

* interface.cc (compare_parameter): For the rank check, NULL()
inherits the rank of a provided MOLD argument.
(gfc_compare_actual_formal): Adjust check of NULL() actual argument
against formal to accept F2008 enhancements (allocatable dummy).
NULL() with MOLD argument retains a pointer/allocatable attribute.
* trans-expr.cc (conv_null_actual): Implement passing NULL() to
derived-type dummy with pointer/allocatable attribute, and ensure
that the actual rank is passed to an assumed-rank dummy.
(gfc_conv_procedure_call): Use it.

gcc/testsuite/ChangeLog:

* gfortran.dg/null_actual_7.f90: New test.
gcc/fortran/interface.cc
gcc/fortran/trans-expr.cc
gcc/testsuite/gfortran.dg/null_actual_7.f90 [new file with mode: 0644]