gnu/gcc/77d5b22efb2b0c291b572f087371d7dc462d5499 Fortran: [PR93727] Add EX format READ (read_ex)
Implement read_ex in libgfortran to handle EX edit-descriptor input
per Fortran 2023 13.7.2.3.6. The input field may contain:
* a hexadecimal-significand form (0X<sig>P<exp>) passed directly
to the C strtod/strtold family for exact bit-for-bit conversion;
* any form acceptable for Fw.d input (decimal fallback), including
INF and NAN representations.
For decimal input without a decimal point the d field of the EX.w.d
descriptor adjusts the exponent exactly as for Fw.d. BN/BZ blank
handling and the kP scale factor are also supported via the shared
decimal path.
Assisted by: Claude Sonnet 4.6
PR fortran/93727
libgfortran/ChangeLog:
* io/read.c (read_ex): New function implementing EX format read.
* io/io.h (read_ex): Declare.
* io/transfer.c (formatted_transfer_scalar_read): Add FMT_EX case
dispatching to read_ex.
gcc/testsuite/ChangeLog:
* gfortran.dg/EXformat_4.F90: New test covering EX format read
for kind=4 and 8 (always) and kind=10, 16 (when available):
hex-significand literals, lowercase prefix, negative binary
exponent, decimal fallback, d-field adjustment, INF/NAN, zero
field, and round-trips through write_ex.
4 files changed