From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by sourceware.org (Postfix) with ESMTPS id 6E3F43858CDA; Tue, 26 Mar 2024 17:43:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6E3F43858CDA Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmx.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6E3F43858CDA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=212.227.17.21 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711474988; cv=none; b=Tqk9ZW5fAIt/o3IC895Zno6LO2m4HFGslx1nhdHGH4WlLlsKU1tm0RrzFUZP/Vrz7YNuiR2je6KSS0p5duyF1Y1sOzBrBINujC5xCFezMTcJzbS0SzX2hANzrc/0KqlBUpREfmSvwn65B0NOEeAFHZt2nEyIg0OxaVnIUyakMEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711474988; c=relaxed/simple; bh=kcrQgdzYl6jhcifViK21qBAtBhiVLtXpUhJeHS0iE6A=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=whrig+k6okYVuIMCPPmZgbqfoRS6HVShuYFUkKnDxU5mIVfYfRXeZYRziwjtlrwYdEGa4VPG79INIgcR8AGi1JF/UbHchTd9emL9UxfuIOEz+v+TvD3u32GGWXEUfIl7Gm9px6e0hFS183KMoIcwpr7Hz7I5a/Ij8fWPd3N4POE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1711474983; x=1712079783; i=anlauf@gmx.de; bh=EAaCKFxrMa1UvM544lollWDTz7Nj5luHOE18EMuTd6s=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=b1JAnaAXOr6chZ1OYmASmvTgsjN3iBGd3G7uVGj7ZfFfzXjGHszyhMHmcj7YHifr krhVuHy4fgBZor4fVRZYOE+4EInxn8ZFqrksv6VxyeWDRewiFvV9anOCRD6Qr/HGV fAdhzmu0c2ul5qE91Ne3Qgt3aUohAgD9pP9pcFqkc/Gihpgx8nS4Hg9j0LV071ftY Jvv9L0bvFs9U27CUB5RYphyxxUlQnZiYSsEtzt+/zZBTekUrLchkZLRfdvm01PsDW qnAzdcWKqvZvzozD/z9+EqC9+/9PWvGIxe1IIVIp9e1fGP4Z1jHHPb8Q4Yru35cmp NDQwSY0gM0eiP2bLsw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.178.29] ([93.207.94.195]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M5QFB-1rq0Ac1Xy1-001Ow4; Tue, 26 Mar 2024 18:43:03 +0100 Message-ID: Date: Tue, 26 Mar 2024 18:43:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [patch, libgfortran] PR107031 - endfile truncates file at wrong position To: Jerry D , gfortran Cc: gcc-patches Newsgroups: gmane.comp.gcc.patches,gmane.comp.gcc.fortran References: <67280203-8877-4be7-b988-a87fb9ff6967@gmail.com> Content-Language: en-US From: Harald Anlauf In-Reply-To: <67280203-8877-4be7-b988-a87fb9ff6967@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:PYyYX7kJuF3cwv6Aru8l7k3PSy950ZKG3IT4SVtCMhMjal/cS9g hTle15kqYoHeH2rKeKqvmDvDY1RiNEn/Ivw/tfJ0mBhLXyfd62d6WoKx9Zu2NoFfpBs3WOL 3zMF8zw/PP0RJWMYMXhOH/C5iH+4JpugMVKVr6MFzus3lpUJtuOvtNu19BqgAploshbXv+A 0BVfrm+perEzUgPlpguRw== UI-OutboundReport: notjunk:1;M01:P0:kc+54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,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dtp.common =3D f= pp->common; > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 memset (&dtp.u.p= , 0, sizeof (dtp.u.p)); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dtp.u.p.current_= unit =3D u; > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 next_record (&dtp, 1); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 unit_truncate (u, stell (u->s), &f= pp->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