This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch,libgfortran] Committed fix to regression in SPEC 200.200.sixtrack miscomparing regression
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 22 Mar 2007 17:20:35 -0700
- Subject: [patch,libgfortran] Committed fix to regression in SPEC 200.200.sixtrack miscomparing regression
Hi all,
With the help of "spark" on IRC we were able to test the attached patch which I
fully regression tested on x86-64. This cures the regression by restoring the
test_endfile function.
I don't have a reduced test case at this time.
Regards,
Jerry
2007-03-22 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/31052
* file_pos.c: Update Copyright year.
* io/open.c (test_endfile): Restore test_endfile to fix SPEC regression.
Update Copyright year.
* io/io.h: Same.
* io/unix.c (is_special): Add missing type for this function.
Update Copyright year.
* io/transfer.c (next_record_r): Restore test_endfile.
(st_read): Fix whitespace. Update Copyright year
Index: ChangeLog
===================================================================
*** ChangeLog (revision 123135)
--- ChangeLog (working copy)
***************
*** 1,3 ****
--- 1,15 ----
+ 2007-03-22 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libgfortran/31052
+ * file_pos.c: Update Copyright year.
+ * io/open.c (test_endfile): Restore test_endfile to fix SPEC regression.
+ Update Copyright year.
+ * io/io.h: Same.
+ * io/unix.c (is_special): Add missing type for this function.
+ Update Copyright year.
+ * io/transfer.c (next_record_r): Restore test_endfile.
+ (st_read): Fix whitespace. Update Copyright year
+
2007-03-20 Francois-Xavier Coudert <coudert@clipper.ens.fr>
* configure.ac: Add missing check for gettimeofday.
Index: io/file_pos.c
===================================================================
*** io/file_pos.c (revision 123135)
--- io/file_pos.c (working copy)
***************
*** 1,4 ****
! /* Copyright (C) 2002-2003, 2005, 2006 Free Software Foundation, Inc.
Contributed by Andy Vaught and Janne Blomqvist
This file is part of the GNU Fortran runtime library (libgfortran).
--- 1,4 ----
! /* Copyright (C) 2002-2003, 2005, 2006, 2007 Free Software Foundation, Inc.
Contributed by Andy Vaught and Janne Blomqvist
This file is part of the GNU Fortran runtime library (libgfortran).
Index: io/open.c
===================================================================
*** io/open.c (revision 123135)
--- io/open.c (working copy)
***************
*** 1,4 ****
! /* Copyright (C) 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Contributed by Andy Vaught
--- 1,4 ----
! /* Copyright (C) 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
Contributed by Andy Vaught
*************** static const st_option convert_opt[] =
*** 109,114 ****
--- 109,127 ----
{ NULL, 0}
};
+ /* Given a unit, test to see if the file is positioned at the terminal
+ point, and if so, change state from NO_ENDFILE flag to AT_ENDFILE.
+ This prevents us from changing the state from AFTER_ENDFILE to
+ AT_ENDFILE. */
+
+ void
+ test_endfile (gfc_unit * u)
+ {
+ if (u->endfile == NO_ENDFILE && file_length (u->s) == file_position (u->s))
+ u->endfile = AT_ENDFILE;
+ }
+
+
/* Change the modes of a file, those that are allowed * to be
changed. */
*************** edit_modes (st_parameter_open *opp, gfc_
*** 195,200 ****
--- 208,215 ----
u->current_record = 0;
u->last_record = 0;
+
+ test_endfile (u); /* We might be at the end. */
break;
case POSITION_APPEND:
*************** new_unit (st_parameter_open *opp, gfc_un
*** 471,476 ****
--- 486,498 ----
memmove (u->file, opp->file, opp->file_len);
u->file_len = opp->file_len;
+ /* Curiously, the standard requires that the
+ position specifier be ignored for new files so a newly connected
+ file starts out at the initial point. We still need to figure
+ out if the file is at the end or not. */
+
+ test_endfile (u);
+
if (flags->status == STATUS_SCRATCH && opp->file != NULL)
free_mem (opp->file);
return u;
Index: io/io.h
===================================================================
*** io/io.h (revision 123135)
--- io/io.h (working copy)
***************
*** 1,4 ****
! /* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Andy Vaught
This file is part of the GNU Fortran 95 runtime library (libgfortran).
--- 1,5 ----
! /* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
! Free Software Foundation, Inc.
Contributed by Andy Vaught
This file is part of the GNU Fortran 95 runtime library (libgfortran).
*************** internal_proto(unlock_unit);
*** 694,699 ****
--- 695,703 ----
/* open.c */
+ extern void test_endfile (gfc_unit *);
+ internal_proto(test_endfile);
+
extern gfc_unit *new_unit (st_parameter_open *, gfc_unit *, unit_flags *);
internal_proto(new_unit);
Index: io/unix.c
===================================================================
*** io/unix.c (revision 123135)
--- io/unix.c (working copy)
*************** is_seekable (stream *s)
*** 1892,1897 ****
--- 1892,1898 ----
/* is_special()-- Return nonzero if the stream is not a regular file. */
+ int
is_special (stream *s)
{
return ((unix_stream *) s)->special_file;
Index: io/transfer.c
===================================================================
*** io/transfer.c (revision 123135)
--- io/transfer.c (working copy)
***************
*** 1,4 ****
! /* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Andy Vaught
Namelist transfer functions contributed by Paul Thomas
--- 1,5 ----
! /* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
! Free Software Foundation, Inc.
Contributed by Andy Vaught
Namelist transfer functions contributed by Paul Thomas
*************** next_record_r (st_parameter_dt *dtp)
*** 2222,2227 ****
--- 2223,2231 ----
break;
}
+
+ if (dtp->u.p.current_unit->flags.access == ACCESS_SEQUENTIAL)
+ test_endfile (dtp->u.p.current_unit);
}
*************** st_read (st_parameter_dt *dtp)
*** 2681,2687 ****
data_transfer_init (dtp, 1);
! /* Handle complications dealing with the endfile record. */
if (dtp->u.p.current_unit->flags.access == ACCESS_SEQUENTIAL)
switch (dtp->u.p.current_unit->endfile)
--- 2685,2691 ----
data_transfer_init (dtp, 1);
! /* Handle complications dealing with the endfile record. */
if (dtp->u.p.current_unit->flags.access == ACCESS_SEQUENTIAL)
switch (dtp->u.p.current_unit->endfile)