]> git.ipfire.org Git - thirdparty/gcc.git/commit
fortran: allow character in conditional expression
authorYuao Ma <c8ef@outlook.com>
Thu, 16 Oct 2025 14:32:52 +0000 (22:32 +0800)
committerc8ef <c8ef@outlook.com>
Sat, 18 Oct 2025 07:22:09 +0000 (15:22 +0800)
commit2c1949bf152f8fcadb0ef7a44113c41d18724691
treed25a0c14bc6c2021757c2d6c38b6f87734eeb44f
parent82cefc4898d4ccabe76e28d6626b91ca9e998923
fortran: allow character in conditional expression

This patch allows the use of character types in conditional expressions.

gcc/fortran/ChangeLog:

* resolve.cc (resolve_conditional): Allow character in cond-expr.
* trans-const.cc (gfc_conv_constant): Handle want_pointer.
* trans-expr.cc (gfc_conv_conditional_expr): Fill se->string_length.
(gfc_conv_string_parameter): Handle COND_EXPR tree code.

gcc/testsuite/ChangeLog:

* gfortran.dg/conditional_1.f90: Test character type.
* gfortran.dg/conditional_2.f90: Test print constants.
* gfortran.dg/conditional_4.f90: Test diagnostic message.
* gfortran.dg/conditional_6.f90: Test character cond-arg.
gcc/fortran/resolve.cc
gcc/fortran/trans-const.cc
gcc/fortran/trans-expr.cc
gcc/testsuite/gfortran.dg/conditional_1.f90
gcc/testsuite/gfortran.dg/conditional_2.f90
gcc/testsuite/gfortran.dg/conditional_4.f90
gcc/testsuite/gfortran.dg/conditional_6.f90