From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C12843858CDA; Sun, 25 Sep 2022 20:07:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C12843858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664136429; bh=1ijagzYNshelZivg29jVTQ/ihjk1LUqi1zsqqhnmrW0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=l2jM/hCZKwhQirEEAdXXdNm5VEofQ9K9e4kQdlHNLKURU1FtMU04S/MjmMq4l4uqD PgEq6EAyhBARAPDeICd/beTcYeTsTefZDDpmBWGPLGz6NRYLdE1zBFygzX/T1b+GQm KEOzPPfQxL/h0fM2LEjyw7DO5DmUOyM3yr7E49Bg= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/107031] endfile truncates file at wrong position Date: Sun, 25 Sep 2022 20:07:09 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libfortran X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107031 --- Comment #3 from anlauf at gcc dot gnu.org --- (In reply to kargl from comment #2) > gfortran's current behavior is correct. >=20 >=20 > 12.3.4.4 File position after data transfer >=20 > In all other cases, the file is positioned after the record just > read or written and that record becomes the preceding record. >=20 > 12.8.3 ENDFILE statement >=20 > Execution of an ENDFILE statement for a file connected for sequential > access writes an endfile record as the next record of the file. >=20 > After reading '5', the file is position at the record that contains '6'. > So, ENDIFLE writes the endfile record after the record with '6'. Hmm, interpretation of text? I read "as the next record", not "after the next record". gfortran differs here from Intel, NAG, Nvidia, AMD Flang, Crayftn.=