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

--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Paul Thomas <[email protected]>:

https://gcc.gnu.org/g:730364c005ea282eedf90e72bb9c71cac27a0f3b

commit r15-11017-g730364c005ea282eedf90e72bb9c71cac27a0f3b
Author: Christopher Albert <[email protected]>
Date:   Tue Mar 10 19:44:29 2026 +0100

    fortran: Fix mixed ENTRY union ABI under -ff2c [PR95338]

    Mixed ENTRY masters store each result in a shared union.  Under -ff2c,
    default REAL entries use the C double ABI even though their Fortran result
    symbols remain default REAL.  Building the union directly from the Fortran
    result symbols therefore gives the entry wrapper a real(kind=8) return type
    but leaves the master union field at real(kind=4), which later trips the
    GIMPLE verifier with a non-trivial conversion in COMPONENT_REF.

    Build the mixed ENTRY union fields from the ABI return type instead, so
    default REAL entries under -ff2c contribute a real(kind=8) field.  Add a
    regression test for the original mixed INTEGER/REAL ENTRY reproducer.

    gcc/fortran/ChangeLog:

            PR fortran/95338
            * trans-types.cc (gfc_get_entry_result_type): New helper to use the
            ABI return type for mixed ENTRY union fields.
            (gfc_get_mixed_entry_union): Use it for each entry result field.

    gcc/testsuite/ChangeLog:

            PR fortran/95338
            * gfortran.dg/pr95338.f90: New test.

    Signed-off-by: Christopher Albert <[email protected]>
    (cherry picked from commit 490c7ba8d880f5a89d25c2791e4b8a95c533c45c)

Reply via email to