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

--- Comment #31 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jerry DeLisle <[email protected]>:

https://gcc.gnu.org/g:5d0a9050f3a1c1f9f8e89188dec3d6f39c64a06a

commit r17-702-g5d0a9050f3a1c1f9f8e89188dec3d6f39c64a06a
Author: Jerry DeLisle <[email protected]>
Date:   Sun May 10 18:13:48 2026 -0700

    Fortran: [PR93727] Implement EX format specifier for WRITE

    These changes implement a portion of the Fortran 2018
    EX format specifier for WRITE output. Hexadecimal
    floating point formats for KIND=4,8,10, and 16 real
    numbers if supported by the configured machine.

    Format tokens are added as place holders for future leading
    zero specifiers.

    Remaining to be completed is proper rounding of truncated
    hex float strings and implementing the READ functions. These
    will be a followup patches.

            PR fortran/93727

    gcc/fortran/ChangeLog:

            * io.cc (enum format_token): Add FMT_EX, FMT_LPS, FMT_LPZ, FMT_LZ
            enums to identify specific tokens.
            (format_lex): Add parsing and checking of the EXw.d and EXw.dEe
edit
            specifiers.

    libgfortran/ChangeLog:

            * io/format.c (format_lex): Add new FMT_EX token handing.
            (parse_format_list): Likewise.
            (next_format): Likewise
            * io/io.h (write_ex): Add prototype for new function.
            (internal_proto): Likewise.
            * io/transfer.c (formatted_transfer_scalar_write): Use FMT_EX
token.
            * io/write.c (write_default_char4): White space fix.
            (write_a): White space fix.
            (write_boz): White space fix.
            (write_decimal): White space fix.
            (otoa_big): White space fix.
            (write_character): White space fix.
            (write_float_0): White space fix.
            (write_ex): New function which uses the new helper function
            get_float_hex_string() to build the hexadecimal float format for
            output.
            (write_real): White space fix.
            (write_complex): White space fix.
            (nml_write_obj): White space fix.
            (namelist_write): White space fix.
            * io/write_float.def: Add defines to handle the various forms of
            KIND=16 floats. These handle the selection of the appropriate
versions
            of the frexp, fabs, and scalbn used to extract the components of
the
            floating point values.
            (GFC_REAL_16_FREXP): New define.
            (GFC_REAL_16_FABS): New define.
            (GFC_REAL_16_SCALBN): New define.
            (get_float_hex_string): New function which exatracts the bits and
builds
            the basic hexadecimal format strings into a buffer. The buffer is
provided
            by the caller write_ex.
            (build_float_string): White space fix.
            (quadmath_snprintf): White space fix.
            (determine_en_precision): White space fix.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/EXformat_1.F90: New test.
            * gfortran.dg/EXformat_2.f90: New test.

    Co-Authored-By: Harald Anlauf <[email protected]>

Reply via email to