public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jerry DeLisle <jvdelisle@charter.net>
To: gfortran <fortran@gcc.gnu.org>
Cc: gcc patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH] PR52251
Date: Sun, 22 Nov 2015 22:59:00 -0000	[thread overview]
Message-ID: <56524315.5090305@charter.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 442 bytes --]

Another old patch I forgot about.  This one is fairly self explanatory.  We were
not handling pending spaces for ADVANCE_NO and T editing.

Regression tested x86-64-linux.  New test case.

OK for trunk?

Jerry


2015-11-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/52251
	* io/transfer.c (formatted_transfer_scalar_write): Reset skips count.
	(finalize_transfer): For ADVANCE_NO, emit pending spaces and reset the
	skip count.


[-- Attachment #2: tab.diff --]
[-- Type: text/x-patch, Size: 939 bytes --]

--- transfer.c	(revision 225410)
+++ transfer.c	(working copy)
@@ -1641,6 +1641,7 @@ formatted_transfer_scalar_write (st_parameter_dt *
 			  - dtp->u.p.current_unit->bytes_left);
 	      dtp->u.p.max_pos = 
 		dtp->u.p.max_pos > tmp ? dtp->u.p.max_pos : tmp;
+	      dtp->u.p.skips = 0;
 	    }
 	  if (dtp->u.p.skips < 0)
 	    {
@@ -3600,6 +3601,16 @@ finalize_transfer (st_parameter_dt *dtp)
      next I/O operation if needed.  */
   if (dtp->u.p.advance_status == ADVANCE_NO)
     {
+      if (dtp->u.p.skips > 0)
+	{
+	  int tmp;
+	  write_x (dtp, dtp->u.p.skips, dtp->u.p.pending_spaces);
+	  tmp = (int)(dtp->u.p.current_unit->recl
+		      - dtp->u.p.current_unit->bytes_left);
+	  dtp->u.p.max_pos = 
+	    dtp->u.p.max_pos > tmp ? dtp->u.p.max_pos : tmp;
+	  dtp->u.p.skips = 0;
+	}
       int bytes_written = (int) (dtp->u.p.current_unit->recl
 	- dtp->u.p.current_unit->bytes_left);
       dtp->u.p.current_unit->saved_pos =

[-- Attachment #3: fmt_t_8.f90 --]
[-- Type: text/x-fortran, Size: 179 bytes --]

! { dg-do run }
! PR52251 Tabs with advance = 'no'
write( *, '( t25 )', advance = 'no' )
write( *, '( "hello" )' ) ! { dg-output "                       hello(\n|\r\n|\r)" }
end


             reply	other threads:[~2015-11-22 22:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-22 22:59 Jerry DeLisle [this message]
2015-11-22 23:00 ` Steve Kargl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56524315.5090305@charter.net \
    --to=jvdelisle@charter.net \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).