]> gcc.gnu.org Git - gcc.git/commit
libgfortran: EN0.0E0 and ES0.0E0 format editing.
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Sat, 3 Feb 2024 02:12:33 +0000 (18:12 -0800)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Sat, 3 Feb 2024 17:31:35 +0000 (09:31 -0800)
commitd436e8e70dacd9c06247bb56d0abeded8fcb4242
tree042962bb82d2cbc5158b7cc6a768275a2a596f17
parent266354012e0aa42e0d1639ee7708595f316cc36b
libgfortran: EN0.0E0 and ES0.0E0 format editing.

F2018 and F2023 standards added zero width exponents. This required
additional special handing in the process of building formatted
floating point strings.

G formatting uses either F or E formatting as documented in
write_float.def comments. This logic changes the format token from FMT_G
to FMT_F or FMT_E. The new formatting requirements interfere with this
process when a FMT_G float string is being built.  To avoid this, a new
component called 'pushed' is added to the fnode structure to save this
condition.  The 'pushed' condition is then used to bypass portions of
the new ES,E,EN, and D formatting, falling through to the existing
default formatting which is retained.

libgfortran/ChangeLog:
PR libfortran/111022
* io/format.c (get_fnode): Update initialization of fnode.
(parse_format_list): Initialization.
* io/format.h (struct fnode): Added the new 'pushed' component.
* io/write.c (select_buffer): Whitespace.
(write_real): Whitespace.
(write_real_w0): Adjust logic for the d == 0 condition.
* io/write_float.def (determine_precision): Whitespace.
(build_float_string): Calculate width of ..E0 exponents and
adjust logic accordingly.
(build_infnan_string): Whitespace.
(CALCULATE_EXP): Whitespace.
(quadmath_snprintf): Whitespace.
(determine_en_precision): Whitespace.

gcc/testsuite/ChangeLog:
PR libfortran/111022
* gfortran.dg/fmt_error_10.f: Show D+0 exponent.
* gfortran.dg/pr96436_4.f90: Show E+0 exponent.
* gfortran.dg/pr96436_5.f90: Show E+0 exponent.
* gfortran.dg/pr111022.f90: New test.
gcc/testsuite/gfortran.dg/fmt_error_10.f
gcc/testsuite/gfortran.dg/pr111022.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pr96436_4.f90
gcc/testsuite/gfortran.dg/pr96436_5.f90
libgfortran/io/format.c
libgfortran/io/format.h
libgfortran/io/write.c
libgfortran/io/write_float.def
This page took 0.069778 seconds and 6 git commands to generate.