From: Tobias Burnus Date: Sun, 22 Apr 2012 17:28:34 +0000 (+0200) Subject: re PR libfortran/53051 (I/O: Support reading floating-point numbers which use "Q... X-Git-Tag: misc/gccgo-go1_1_2~3366 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=96b3ee1c504a6507154bbbfcf081a8f969fb8671;p=thirdparty%2Fgcc.git re PR libfortran/53051 (I/O: Support reading floating-point numbers which use "Q" for the exponent) 2012-04-22 Tobias Burnus PR fortran/53051 * io/list_read.c (parse_real): Support "q" for the exponential. * io/read.c (read_f): Ditto. 2012-04-22 Tobias Burnus PR fortran/53051 * gfortran.dg/read_float_4.f90: New. From-SVN: r186675 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5f4f4b62dc63..d2877e72304b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-04-22 Tobias Burnus + + PR fortran/53051 + * gfortran.dg/read_float_4.f90: New. + 2012-04-21 Manuel López-Ibáñez PR 35441 diff --git a/gcc/testsuite/gfortran.dg/read_float_4.f90 b/gcc/testsuite/gfortran.dg/read_float_4.f90 new file mode 100644 index 000000000000..01a0de8c04f1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/read_float_4.f90 @@ -0,0 +1,18 @@ +! { dg-do run } +! +! PR libgfortran/53051 +! +! Check that reading "4.0q0" works, i.e. floating-point +! numbers which use "q" to indicate the exponential. +! (Which is a vendor extension.) +! + character(len=20) :: str + real :: r + integer :: i + + r = 0 + str = '1.0q0' + read(str, *, iostat=i) r + if (r /= 1.0 .or. i /= 0) call abort() + !print *, r + end diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 7f1a082a2648..ec662841ee28 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,10 @@ +2012-04-22 Tobias Burnus + + PR fortran/53051 + * io/list_read.c (parse_real): Support "q" for the + exponential. + * io/read.c (read_f): Ditto. + 2012-04-17 Tobias Burnus PR libfortran/38199 diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 2024fcd9b6cf..4d2ce7941201 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -1136,6 +1136,8 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length) case 'E': case 'd': case 'D': + case 'q': + case 'Q': push_char (dtp, 'e'); goto exp1; @@ -1449,6 +1451,8 @@ read_real (st_parameter_dt *dtp, void * dest, int length) case 'e': case 'D': case 'd': + case 'Q': + case 'q': goto exp1; case '+': @@ -1546,6 +1550,8 @@ read_real (st_parameter_dt *dtp, void * dest, int length) case 'e': case 'D': case 'd': + case 'Q': + case 'q': goto exp1; case '+': diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c index aa41bc7b9d28..32c8b3250f8e 100644 --- a/libgfortran/io/read.c +++ b/libgfortran/io/read.c @@ -1026,6 +1026,8 @@ found_digit: case 'E': case 'd': case 'D': + case 'q': + case 'Q': ++p; --w; goto exponent;