aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2024-03-11 15:15:34 -0700
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2024-03-11 15:15:34 -0700
commit0c179654c3170749f3fb3232f2442fcbc99bffbb (patch)
treec027515a7d503d0d08b125fba53342b7b6a29ec1
parent9b3243858bed000b0ee8c3cf718f61b0e75e72ec (diff)
downloadgcc-0c179654c3170749f3fb3232f2442fcbc99bffbb.zip
gcc-0c179654c3170749f3fb3232f2442fcbc99bffbb.tar.gz
gcc-0c179654c3170749f3fb3232f2442fcbc99bffbb.tar.bz2
libgfortran: [PR114304] Revert portion of PR105347 change.
PR libfortran/105437 PR libfortran/114304 libgfortran/ChangeLog: * io/list_read.c (eat_separator): Remove check for decimal point mode and semicolon used as a seprator. Removes the regression. gcc/testsuite/ChangeLog: * gfortran.dg/pr105473.f90: Add additional checks to address the case of semicolon at the end of a line.
-rw-r--r--gcc/testsuite/gfortran.dg/pr105473.f9021
-rw-r--r--libgfortran/io/list_read.c12
2 files changed, 15 insertions, 18 deletions
diff --git a/gcc/testsuite/gfortran.dg/pr105473.f90 b/gcc/testsuite/gfortran.dg/pr105473.f90
index b309217..2679f6b 100644
--- a/gcc/testsuite/gfortran.dg/pr105473.f90
+++ b/gcc/testsuite/gfortran.dg/pr105473.f90
@@ -3,44 +3,51 @@
implicit none
integer n,m,ios
real r
+ real :: x(3)
complex z
character(40):: testinput
n = 999; m = 777; r=1.2345
z = cmplx(0.0,0.0)
-! Check that semi-colon is not allowed as separator with decimal=point.
+! Check that semi-colon is allowed as separator with decimal=point.
ios=0
testinput = '1;17;3.14159'
read(testinput,*,decimal='point',iostat=ios) n, m, r
- if (ios /= 5010) print *, "stop 1"
+ if (ios /= 0) stop 1
+! Check that semi-colon allowed as a separator with decimal=point.
+ ios=0
+ testinput = '1.23435 1243.24 13.24 ;'
+ read(testinput, *, iostat=ios) x
+ if (ios /= 0) stop 2
+
! Check that comma is not allowed as a separator with decimal=comma.
ios=0
testinput = '1,17,3,14159'
read(testinput,*,decimal='comma',iostat=ios) n, m, r
- if (ios /= 5010) print *, "stop 2"
+ if (ios /= 5010) stop 3
! Check a good read.
ios=99
testinput = '1;17;3,14159'
read(testinput,*,decimal='comma',iostat=ios) n, m, r
- if (ios /= 0) print *, "stop 3"
+ if (ios /= 0) stop 4
! Check that comma is not allowed as a separator with decimal=comma.
ios=99; z = cmplx(0.0,0.0)
testinput = '1,17, (3,14159, 1,7182)'
read(testinput,*,decimal='comma', iostat=ios) n, m, z
- if (ios /= 5010) stop 4
+ if (ios /= 5010) stop 5
! Check that semi-colon is not allowed as separator with decimal=point.
ios=99; z = cmplx(0.0,0.0)
testinput = '1,17; (3.14159; 1.7182)'
read(testinput,*,decimal='point', iostat=ios) n, m, z
- if (ios /= 5010) stop 5
+ if (ios /= 5010) stop 6
! Check a good read.
ios=99;z = cmplx(0.0,0.0)
testinput = '1;17; (3,14159; 1,7182)'
read(testinput,*,decimal='comma', iostat=ios) n, m, z
- if (ios /= 0) stop 6
+ if (ios /= 0) stop 7
end program
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index e38e9a8..fb3f7db 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -476,18 +476,8 @@ eat_separator (st_parameter_dt *dtp)
unget_char (dtp, c);
break;
}
- dtp->u.p.comma_flag = 1;
- eat_spaces (dtp);
- break;
-
+ /* Fall through. */
case ';':
- if (dtp->u.p.current_unit->decimal_status == DECIMAL_POINT)
- {
- generate_error (&dtp->common, LIBERROR_READ_VALUE,
- "Semicolon not allowed as separator with DECIMAL='point'");
- unget_char (dtp, c);
- break;
- }
dtp->u.p.comma_flag = 1;
eat_spaces (dtp);
break;