public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, libgfortran] PR98825 Unexpected behavior of FORTRAN FORMAT expressions when suppressing new line with '$'
@ 2021-02-07 13:34 Jerry DeLisle
  2021-02-07 17:07 ` Thomas Koenig
  0 siblings, 1 reply; 3+ messages in thread
From: Jerry DeLisle @ 2021-02-07 13:34 UTC (permalink / raw)
  To: gfortran; +Cc: gcc-patches

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

Hello all,

Attached patch fixes this and adds a test case. The "$" edit descriptor 
was being completely ignored when next_record_w is processed. Fixed by 
adding a simple check.

OK for trunk and backport to 10 since it is simple enough?

Regards,

Jerry

libgfortran: Do not emit end-of-record if seen_dollar.

2021-02-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

libgfortran/ChangeLog:
     PR libgfortran/98825
     * io/transfer.c (next_record_w): Insert check for seen_dollar and if
     so, skip issueing next record.

gcc/testsuite/ChangeLog:

     * gfortran.dg/dollar_edit_descriptor_4.f: New test.


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

diff --git a/gcc/testsuite/gfortran.dg/dollar_edit_descriptor_4.f b/gcc/testsuite/gfortran.dg/dollar_edit_descriptor_4.f
new file mode 100644
index 00000000000..c8453ce6bc8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/dollar_edit_descriptor_4.f
@@ -0,0 +1,16 @@
+! { dg-do run }
+! { dg-options "-std=gnu" }
+! PR98825 Test for fix of '$' edit descriptor.
+      character(30) :: line
+   10 format (i3,$)
+
+      open(10, status='scratch')
+      write (10,10) 1
+      write (10,10) 2,3,4,5
+! Check the result.
+      line = 'abcdefg'
+      rewind(10)
+      read(10, '(a)') line
+      close(10)
+      if (line .ne. '  1  2  3  4  5') call abort
+      end
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 8ab0583dd55..27bee9d4e01 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -4020,6 +4020,8 @@ next_record_w (st_parameter_dt *dtp, int done)
 		}
 	    }
 	}
+      else if (dtp->u.p.seen_dollar == 1)
+	break;
       /* Handle legacy CARRIAGECONTROL line endings.  */
       else if (dtp->u.p.current_unit->flags.cc == CC_FORTRAN)
 	next_record_cc (dtp);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch, libgfortran] PR98825 Unexpected behavior of FORTRAN FORMAT expressions when suppressing new line with '$'
  2021-02-07 13:34 [patch, libgfortran] PR98825 Unexpected behavior of FORTRAN FORMAT expressions when suppressing new line with '$' Jerry DeLisle
@ 2021-02-07 17:07 ` Thomas Koenig
  2021-02-11  3:48   ` Jerry DeLisle
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Koenig @ 2021-02-07 17:07 UTC (permalink / raw)
  To: Jerry DeLisle, gfortran; +Cc: gcc-patches


Hi Jerry,

> OK for trunk and backport to 10 since it is simple enough?

OK for trunk.

Because this is a user-visible change (even if we did the wrong
thing before) I don't feel that we should backport (but I am
open to suggestions otherwise).

Could you also mention this in gcc-11/changes.html ?

Best regards

	Thomas

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch, libgfortran] PR98825 Unexpected behavior of FORTRAN FORMAT expressions when suppressing new line with '$'
  2021-02-07 17:07 ` Thomas Koenig
@ 2021-02-11  3:48   ` Jerry DeLisle
  0 siblings, 0 replies; 3+ messages in thread
From: Jerry DeLisle @ 2021-02-11  3:48 UTC (permalink / raw)
  To: Thomas Koenig, gfortran; +Cc: gcc-patches



On 2/7/21 9:07 AM, Thomas Koenig wrote:
>
> Hi Jerry,
>
>> OK for trunk and backport to 10 since it is simple enough?
>
> OK for trunk.
>
> Because this is a user-visible change (even if we did the wrong
> thing before) I don't feel that we should backport (but I am
> open to suggestions otherwise).
>
> Could you also mention this in gcc-11/changes.html ?
>
> Best regards
>
>     Thomas

The above was committed.  I had a very frustrating experiance with the 
push process.  Over and over attempting to push and having it rejected 
for an invalid PR reference. The directory that holds the runtime 
library is called "libgfortran".  The official gcc component in Bugzilla 
is called "libfortran".  There is no letter "g" in that component name 
and thus the hooks rejected my push attempts.  The only reason I figured 
it out, after exhausting about 25 other variations I could think of is 
that I thought "What does the PR think this is?"

Well that was not intuitively obvious, but my bug tracking persistance 
hung in there. Sheesh!

Just telling people so others might be aware of this little detail.

Thomas, I will get around to updating the changes.html.

Thanks and best regards,

Jerry

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-11  3:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-07 13:34 [patch, libgfortran] PR98825 Unexpected behavior of FORTRAN FORMAT expressions when suppressing new line with '$' Jerry DeLisle
2021-02-07 17:07 ` Thomas Koenig
2021-02-11  3:48   ` Jerry DeLisle

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).