aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2025-01-29 13:40:59 -0800
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2025-02-06 09:43:26 -0800
commitcfed99751c1a3b93ca66451eb1b62271e682f927 (patch)
treee265e3c52b148bfa99063cd73bb5d557fbde20d3 /gcc
parent6305c46fad5ae9b3b94b069c040cdd0c67e6e49e (diff)
downloadgcc-cfed99751c1a3b93ca66451eb1b62271e682f927.zip
gcc-cfed99751c1a3b93ca66451eb1b62271e682f927.tar.gz
gcc-cfed99751c1a3b93ca66451eb1b62271e682f927.tar.bz2
Fortran: Fix handling of the X edit descriptor.
This patch is a partial fix of handling of X edit descriptors when combined with certain T edit descriptors. PR libfortran/114618 libgfortran/ChangeLog: * io/transfer.c (formatted_transfer_scalar_write): Change name of vriable 'pos' to 'tab_pos' to improve clarity. Add new variable next_pos when calculating the maximum position. Update the calculation of pending spaces. gcc/testsuite/ChangeLog: * gfortran.dg/pr114618.f90: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gfortran.dg/pr114618.f9015
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/pr114618.f90 b/gcc/testsuite/gfortran.dg/pr114618.f90
new file mode 100644
index 0000000..835597b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr114618.f90
@@ -0,0 +1,15 @@
+! { dg-do run }
+! PR114618 Format produces incorrect output when contains 1x, ok when uses " "
+! aside: Before patch output1 is garbage.
+program pr114618
+ implicit none
+ integer, parameter :: wp = kind(0d0)
+ real(kind=wp) :: pi = 3.14159265358979323846264338_wp
+ character(len=*), parameter:: fmt1 = '(19("."),t1,g0,1x,t21,g0)'
+ character(len=*), parameter:: fmt2 = '(19("."),t1,g0," ",t21,g0)'
+ character(21) :: output1, output2
+ write (output1, fmt1) 'RADIX', radix(pi)
+ write (output2, fmt2) 'RADIX', radix(pi)
+ if (output1 /= 'RADIX.............. 2') stop 1
+ if (output2 /= 'RADIX ............. 2') stop 2
+end program pr114618