aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2025-08-05 12:10:24 -0700
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2025-08-05 17:34:47 -0700
commit3d496ed9a5821ae9188e5242c1e26eea80c4039f (patch)
treef956851a2b7bceb07a8099e433bd127c66f7aedf /gcc
parent10b8ba6f0f1308df9eb9df3a5e8ce9ecaa227ecb (diff)
downloadgcc-3d496ed9a5821ae9188e5242c1e26eea80c4039f.zip
gcc-3d496ed9a5821ae9188e5242c1e26eea80c4039f.tar.gz
gcc-3d496ed9a5821ae9188e5242c1e26eea80c4039f.tar.bz2
Fortran: Fix runtime bogus diagnostic with ';'
PR libfortran/121234 libgfortran/ChangeLog: * io/list_read.c (read_character): Add checks to bypass eating semicolons when reading strings with decimal mode 'point' (list_formatted_read_scalar): Likewise. gcc/testsuite/ChangeLog: * gfortran.dg/pr121234.f90: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gfortran.dg/pr121234.f9028
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/pr121234.f90 b/gcc/testsuite/gfortran.dg/pr121234.f90
new file mode 100644
index 0000000..8eb1af53
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr121234.f90
@@ -0,0 +1,28 @@
+! { dg-do run }
+! PR121234 Bogus diagnostic on READ of string with semicolon.
+ character(12) buffer,a
+ a = 'xxxxxxxxxx'
+ buffer="33;44"
+ read(buffer,*) a
+ if (a .ne. "33;44") stop 1
+ a = 'xxxxxxxxxx'
+ buffer=" ;;33 ,44 "
+ read(buffer,*,decimal="comma") a
+ if (a .ne. 'xxxxxxxxxx') stop 2 ! A null read
+ a = 'xxxxxxxxxx'
+ buffer=" ;;33 ,44 "
+ read(buffer,*,decimal="point") a
+ if (a .ne. ';;33') stop 3 ! Spaces are delimiting
+ a = 'xxxxxxxxxx'
+ buffer=";;33;,44 "
+ read(buffer,*) a
+ if (a .ne. ';;33;') stop 4 ! Comma is delimiting
+ a = 'xxxxxxxxxx'
+ buffer=";;33;44;; "
+ read(buffer,*) a
+ if (a .ne. ';;33;44;;') stop 5 ! Space is delimiting
+ a = 'xxxxxxxxxx'
+ buffer=";;33;44;;;.7"
+ read(buffer,*) a
+ if (a .ne. ';;33;44;;;.7') stop 6 ! Space is delimiting
+end