public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gmx.de>
To: Jerry D <jvdelisle2@gmail.com>, gfortran <fortran@gcc.gnu.org>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch, libgfortran] PR107031 - endfile truncates file at wrong position
Date: Tue, 26 Mar 2024 18:43:02 +0100	[thread overview]
Message-ID: <c591c272-e9dc-4b01-97dc-9397ea7389ee@gmx.de> (raw)
In-Reply-To: <67280203-8877-4be7-b988-a87fb9ff6967@gmail.com>

Hi Jerry,

Am 26.03.24 um 04:18 schrieb Jerry D:
> Hi all,
>
> There has been a bit of discussio on which way to go on this.
>
> I took a look today and this trivial patch gives the behavior concluded
> on Fortran Discourse. See the bugzilla for all the relevant information.
>
> Regresion tested on x86-64.
>
> I will do the appropriate changelog.
>
> OK for trunk?
>
> Attached is a new test case and the patch here:
>
> diff --git a/libgfortran/io/file_pos.c b/libgfortran/io/file_pos.c
> index 2bc05b293f8..d169961f997 100644
> --- a/libgfortran/io/file_pos.c
> +++ b/libgfortran/io/file_pos.c
> @@ -352,7 +352,6 @@ st_endfile (st_parameter_filepos *fpp)
>            dtp.common = fpp->common;
>            memset (&dtp.u.p, 0, sizeof (dtp.u.p));
>            dtp.u.p.current_unit = u;
> -         next_record (&dtp, 1);
>          }
>
>         unit_truncate (u, stell (u->s), &fpp->common);

this is OK from my side.

Given the discussion on "dg-do  run", wouldn't this be a perfect
example where it is sufficient to run the testcase just once?

The change is in libgfortran, not in the frontend or middle-end.

Thanks for the patch!

Harald


      reply	other threads:[~2024-03-26 17:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26  3:18 Jerry D
2024-03-26 17:43 ` Harald Anlauf [this message]

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=c591c272-e9dc-4b01-97dc-9397ea7389ee@gmx.de \
    --to=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jvdelisle2@gmail.com \
    /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).