[PATCH] fortran: [PR125724] ICE passing NULL() to an allocatable dummy argument

Jerry D jvdelisle2@gmail.com
Sun Oct 11 17:51:19 GMT 2026


The master branch has been updated by Jerry DeLisle <jvdelisle@gcc.gnu.org>:

https://gcc.gnu.org/g:21814c1470de32bb742c2f0a1b505323e1b8ff26

commit r17-5066-g21814c1470de32bb742c2f0a1b505323e1b8ff26
Author: Jerry DeLisle <jvdelisle@gcc.gnu.org>
Date:   Wed Jun 10 08:37:01 2026 -0700

     fortran: [PR125724] ICE passing NULL() to an allocatable dummy argument

and thanks again
On 10/11/26 2:59 AM, Mikael Morin wrote:
> Le 10/10/2026 à 21:57, Jerry DeLisle a écrit :
>> See attached patch. Passing NULL() to an allocatable dummy of intrinsic
>> type ICEs on a gcc_assert in gfc_conv_procedure_call, which expects a
>> NULL() actual there only for an optional, non-allocatable dummy. Only
>> derived-type dummies were sent to conv_null_actual. The patch sends
>> non-class, non-character allocatable dummies there as well, and
>> conv_null_actual builds the null descriptor for them with
>> gfc_create_null_actual_descriptor, as it already does for derived types.
>> CLASS and CHARACTER allocatable dummies are left as they are.
>>
>> Start with the condition in gfc_conv_procedure_call that selects
>> conv_null_actual, then the widened derived-type branch of
>> conv_null_actual, both in trans-expr.cc; the rest is the new test. The
>> bug was found with the Fujitsu compiler test suite; the test is new.
>>
>> Regression tested on x86_64.
>>
>> OK for mainline?
>>
>> Regards,
>>
>> Jerry
>>
>> ---
>>
>> fortran: [PR125724] ICE passing NULL() to an allocatable dummy argument
>>
>> Pass a NULL() actual argument for a non-class, non-character
>> allocatable dummy through conv_null_actual, as for derived-type
>> dummies.
>>
>> Assisted-by: Claude Opus 5.5
>>
>>     PR fortran/125724
>>
>> gcc/fortran/ChangeLog:
>>
>>     * trans-expr.cc (conv_null_actual): Handle intrinsic allocatable
>>     and pointer dummies.
>>     (gfc_conv_procedure_call): Use conv_null_actual for a NULL()
>>     actual with a non-class, non-character allocatable dummy.
>>
>> gcc/testsuite/ChangeLog:
>>
>>     * gfortran.dg/null_actual_8.f90: New test.
> OK.



More information about the Gcc-patches mailing list