This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, libgfortran] PR16435 and NIST fm908.for
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: Paul Thomas <paulthomas2 at wanadoo dot fr>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Wed, 13 Jul 2005 22:33:38 +0200
- Subject: Re: [Patch, libgfortran] PR16435 and NIST fm908.for
- References: <42D3F74F.7040709@wanadoo.fr>
Paul Thomas wrote:
> + /* Number of skips + spaces to be done for T and X-editting. */
Here and immediately below, 'editing' with a single t.
> *************** export_proto(st_read);
> *** 1537,1542 ****
> --- 1575,1584 ----
> void
> st_read (void)
> {
> +
> + /* Reset counters for T and X-editting. */
> + max_pos = skips = pending_spaces = 0;
> +
> library_start ();
>
> data_transfer_init (1);
> *************** export_proto(st_write);
> *** 1582,1587 ****
> --- 1624,1633 ----
> void
> st_write (void)
> {
> +
> + /* Reset counters for T and X-editting. */
> + max_pos = skips = pending_spaces = 0;
> +
> library_start ();
> data_transfer_init (0);
> }
Put these into data_transfer_init. That would save you the duplication; you
could also check for formatted I/O there.
> --- 1076,1091 ----
> /* Take care of the X/TR descriptor. */
>
> void
> ! write_x (int m, int nspaces)
> {
> char *p;
>
> ! p = write_block (m);
> if (p == NULL)
> return;
>
> ! if (nspaces > 0)
> ! memset ((char*)(p + m - nspaces), ' ', nspaces);
&p[m - nspaces], not only does this look simpler to me, you'd need size_t
otherwise. I'd also find it clearer if you renamed 'm' to 'len' or 'length'
as in the rest of the file.
> 2005-07-12 Paul Thomas <pault@gcc.gnu.org>
>
> * transfer.c (formatted_transfer): Correct the problems
> with X- and T-editting that caused TLs followed by TRs
> to overwrite data, which caused NIST FM908.FOR to fail
> on many tests.
> (st_read, st_write) Zero X- and T-editting counters at
> the strat of formatted IO.
> * write.c (write_x) Write specified number of skips with
> specified number of spaces at the end.
>
> 2005-07-12 Paul Thomas <pault@gcc.gnu.org>
>
> * gfortran.dg/tl_editting.f90: New.
Ok with these corrections.
Thanks,
- Tobi