Re: [PATCH] Fortran: [PR93727] Add EX format READ (read_ex)

Jerry D <[email protected]> Sun, 7 Jun 2026 11:53:59 -0700
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <[email protected]>
On 6/7/26 11:37 AM, Harald Anlauf wrote:
> Hi Jerry!
> 
> Am 03.06.26 um 10:42 PM schrieb Jerry D:
>> The following implements the last of the EX formatting work. The attached 
>> patch has been regression tested on x86_64. The test case provided round trip 
>> testing to ensure what we read is what we wrote.
>>
>> OK for mainline?
> 
> Works here, LGTM.  OK for mainline.
> 
> The only missing piece seems to be for list-directed read,
> see in particular F2023:13.7.2.3.2 F editing, clause (7).
> 
> (Intel and NAG support this.)
> 
> Thanks for the great work!
> 
> Harald

Thanks Harald. Next on the list will be the list_read part.

Regards,

Jerry

> 
>> Best regards,
>>
>> Jerry
>> ---
>> 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.
>> ---
>