[PATCH, committed] Fix mixed ENTRY union ABI under -ff2c [PR95338]

Jerry D <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <[email protected]>
The master branch has been updated by Jerry DeLisle <[email protected]>:

https://gcc.gnu.org/g:490c7ba8d880f5a89d25c2791e4b8a95c533c45c

commit r16-8014-g490c7ba8d880f5a89d25c2791e4b8a95c533c45c
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]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.