This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran] PATCH fix PR libfortran/20257


The problem still isn't fixed when we write to preconnected units
(stdout, stdin), since it requires more thinking

I should have waited a little. Here is the complete patch, fixing all PR 20257 (for both OPENed and preconnected units). It's an easy two-lines (plus comments and testcase) patch.


*strapped and regtested on i686-linux. OK for mainline and 4.0? If so,
please commit (I don't have CVS write access).



2005-03-03 Francois-Xavier Coudert <coudert@clipper.ens.fr>

	PR libfortran/20257
	* open.c (new_unit): set record length to max_offset rather than
	  using a hard-coded limit (which was too low).
	* io.h: changed default record length for preconnected units
	  to 1 Gb.


2005-03-03 Francois-Xavier Coudert <coudert@clipper.ens.fr>


	PR libfortran/20257
	* write_big_array.f90: New test.
! { dg-do run }
  integer,parameter :: n = 10000
  real(8) array(10000)

  array(:) = 0
  open (10, status='scratch')
  write (10,*) array
  close (10)
  write (*,*) array
end
Index: libgfortran/io/open.c
===================================================================
RCS file: /cvsroot/gcc/gcc/libgfortran/io/open.c,v
retrieving revision 1.10
diff -p -u -r1.10 open.c
--- libgfortran/io/open.c       23 Jan 2005 00:14:30 -0000      1.10
+++ libgfortran/io/open.c       3 Mar 2005 10:10:51 -0000
@@ -358,7 +358,7 @@ new_unit (unit_flags * flags)
 
   /* Unspecified recl ends up with a processor dependent value.  */
 
-  u->recl = (ioparm.recl_in != 0) ? ioparm.recl_in : DEFAULT_RECL;
+  u->recl = (ioparm.recl_in != 0) ? ioparm.recl_in : g.max_offset;
   u->last_record = 0;
   u->current_record = 0;
 
Index: libgfortran/io/io.h
===================================================================
RCS file: /cvsroot/gcc/gcc/libgfortran/io/io.h,v
retrieving revision 1.16
diff -p -u -r1.16 io.h
--- libgfortran/io/io.h 23 Jan 2005 00:14:30 -0000      1.16
+++ libgfortran/io/io.h 3 Mar 2005 13:04:37 -0000
@@ -245,10 +245,11 @@ typedef struct
 unit_flags;
 
 
-/* The default value of record length is defined here.  This value can
-   be overriden by the OPEN statement or by an environment variable.  */
+/* The default value of record length for preconnected units is defined
+   here. This value can be overriden by an environment variable.
+   Default value is 1 Gb.  */
 
-#define DEFAULT_RECL 10000
+#define DEFAULT_RECL 1073741824
 
 
 typedef struct gfc_unit

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]