[PATCH] fortran: support .NIL. in conditional arguments
Steve Kargl
sgk@troutmask.apl.washington.edu
Mon Oct 20 18:17:26 GMT 2025
On Mon, Oct 20, 2025 at 12:48:13PM +0200, Tobias Burnus wrote:
> Yuao Ma wrote:
> > This patch introduces support for the NIL value within conditional
> > arguments, addressing several scenarios for how NIL should be handled.
>
> Let's start with two testcases that fail:
>
> (A) Passing a string argument
>
> I found a test that fails with an ICE (segmentation fault)
> in generic_simplify_COND_EXPR, called by gfc_conv_conditional_expr:
>
> implicit none
> interface
> subroutine sub(x)
> character(*), optional :: x
> end
> end interface
> logical :: cc
> call sub( (cc ? "132" : .nil.))
> end
I don't have the patch installed, so cannot directly test;
but, the above is technically a invalid program. 'cc' is
referenced but never defined. I would expect a warning
with -Wall and an ICE is possible as 'cc' can be using
whatever is in memory.
--
steve
More information about the Fortran
mailing list