diff options
author | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2017-05-29 19:17:57 +0000 |
---|---|---|
committer | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2017-05-29 19:17:57 +0000 |
commit | fd262197d74626579a784ee1cc0f3f3a0e3f33e9 (patch) | |
tree | 92cfd1b6d2284c50ad86327360b617f65d955161 | |
parent | a5cfa13ab9ef5b9a740129fca6b73acea436c493 (diff) | |
download | gcc-fd262197d74626579a784ee1cc0f3f3a0e3f33e9.zip gcc-fd262197d74626579a784ee1cc0f3f3a0e3f33e9.tar.gz gcc-fd262197d74626579a784ee1cc0f3f3a0e3f33e9.tar.bz2 |
re PR fortran/53029 (missed optimization in internal read (without implied-do-loop))
2017-05-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/53029
* list_read.c (list_formatted_read_scala): Set the err return
value to the common.flags error values.
* gfortran.dg/read_5.f90: New test.
From-SVN: r248577
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/read_5.f90 | 21 | ||||
-rw-r--r-- | libgfortran/ChangeLog | 6 | ||||
-rw-r--r-- | libgfortran/io/list_read.c | 5 |
4 files changed, 37 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4eb53a7..58dd05b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-05-29 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libgfortran/53029 + * gfortran.dg/read_5.f90: New test. + 2017-05-29 Nathan Sidwell <nathan@acm.org> PR c++/80891 (#4) diff --git a/gcc/testsuite/gfortran.dg/read_5.f90 b/gcc/testsuite/gfortran.dg/read_5.f90 new file mode 100644 index 0000000..81f1f11 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/read_5.f90 @@ -0,0 +1,21 @@ +! { dg-do run } +! PR53029 Missed optimization, this test case took several seconds to + program internalread + implicit none + integer m + parameter(m=1000000) + character value*10 + character(80) :: result + integer i,j,intvalues(m) + real :: start, finish + intvalues = 33 + call cpu_time(start) + do j=1,100 + write(value,'(i3,a5)') j," 5 69" + read(value,*,end=20) intvalues + 20 write(result,*) (intvalues(i),i=2,4) + if (result.ne.(' 5 69 33')) call abort + call cpu_time(finish) + if ((finish-start).gt. 0.5) call abort + enddo + end program internalread diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index eaeac6a..e763232 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2017-05-29 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libgfortran/53029 + * list_read.c (list_formatted_read_scala): Set the err return + value to the common.flags error values. + 2017-05-28 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * acinclude.m4 (LIBGFOR_CHECK_FMA3): Use test from diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 6c00d11..b6cd667 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -2298,11 +2298,16 @@ list_formatted_read_scalar (st_parameter_dt *dtp, bt type, void *p, free_saved (dtp); cleanup: + /* err may have been set above from finish_separator, so if it is set + trigger the hit_eof. The hit_eof will set bits in common.flags. */ if (err == LIBERROR_END) { free_line (dtp); hit_eof (dtp); } + /* Now we check common.flags for any errors that could have occurred in + a READ elsewhere such as in read_integer. */ + err = dtp->common.flags & IOPARM_LIBRETURN_MASK; fbuf_flush_list (dtp->u.p.current_unit, LIST_READING); return err; } |