https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125393

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-16 branch has been updated by Harald Anlauf
<[email protected]>:

https://gcc.gnu.org/g:3968d5fb552fbd2e0687a20e8221e4e08d49da04

commit r16-9034-g3968d5fb552fbd2e0687a20e8221e4e08d49da04
Author: Harald Anlauf <[email protected]>
Date:   Thu May 28 22:49:26 2026 +0200

    Fortran: checking of passed character length [PR125393]

    Commit r16-3462 enhanced checking of character length passed to a character
    dummy.  However, when the actual argument was an array element, its storage
    size was estimated from all elements up to the end of the array.  This
    could give a bogus warning when the dummy argument was of a scalar
    character type.  Fix check for this case to actually compare the character
    lengths of actual and dummy.

            PR fortran/125393

    gcc/fortran/ChangeLog:

            * interface.cc (get_expr_storage_size): Additionally return
            character length.
            (gfc_compare_actual_formal): When the formal is a scalar character
            variable, use character lengths, not array storage size for check.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/argument_checking_28.f90: New test.

    (cherry picked from commit 47bb24546297ef6812d69bc800ec005fc7e567e9)

Reply via email to