aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2024-02-12 13:12:08 -0800
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2024-02-12 15:29:04 -0800
commit153ce7a78edbe339fa0b1cd314dea0554f59faf0 (patch)
tree8d11b9cdbb397e2f6ea2d06112d76a0f310c92fd /gcc/testsuite/gfortran.dg
parent065dddc6e07a917c57c7955db13b1fe77abbcabc (diff)
downloadgcc-153ce7a78edbe339fa0b1cd314dea0554f59faf0.zip
gcc-153ce7a78edbe339fa0b1cd314dea0554f59faf0.tar.gz
gcc-153ce7a78edbe339fa0b1cd314dea0554f59faf0.tar.bz2
libgfortran: Adjust bytes_left and pos for access="STREAM".
During tab edits, the pos (position) and bytes_used Variables were not being set correctly for stream I/O. Since stream I/O does not have 'real' records, the format buffer active length must be used instead of the record length variable. PR libgfortran/109358 libgfortran/ChangeLog: * io/transfer.c (formatted_transfer_scalar_write): Adjust bytes_used and pos variable for stream access. gcc/testsuite/ChangeLog: * gfortran.dg/pr109358.f90: New test.
Diffstat (limited to 'gcc/testsuite/gfortran.dg')
-rw-r--r--gcc/testsuite/gfortran.dg/pr109358.f9014
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/pr109358.f90 b/gcc/testsuite/gfortran.dg/pr109358.f90
new file mode 100644
index 0000000..5013984
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr109358.f90
@@ -0,0 +1,14 @@
+! { dg-do run }
+! PR109358, test that tabs during stream io are correct.
+program tabs
+ implicit none
+ integer :: fd
+ character(64) :: line
+ open(newunit=fd, file="otabs.txt", form="formatted", access="stream")
+ write(fd, "(i4, t40, i4, t20, i5.5)") 1234, 5555, 67890
+ close(fd)
+ open(newunit=fd, file="otabs.txt", form="formatted")
+ read(fd,"(a)") line
+ close(fd, status='delete')
+ if (line .ne. "1234 67890 5555") stop 10
+end program tabs