From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id B5FA83858D28; Thu, 16 Dec 2021 16:34:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B5FA83858D28 Received: by mail-wr1-x429.google.com with SMTP id o13so45143941wrs.12; Thu, 16 Dec 2021 08:34:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=6L5ZrJMG4miCg2EbHqXZFXCqBij8WhSBOmtdrBZ6G1M=; b=RMOT5IAxD7k/t1bnrj0xujdtKbW4BKpKsu+S+Mkf9LFCXlaKd+tylDWdOwiQSNt4PL 6Q9Z8MRy/spoEfCoNEko0GhLcNjIbG+xvbLIVB8/FLUi3dfF40gs/6WeIGONlyglAK+F XA+6sGdXixeZYbExmJIc6LWeCpQItHBdVdT7+4CyNXzQ481a1D2MEX3B5VGBWwv9UhqL QbWP3uxj9XJDRc4o/oXxCmQx9Ompp1+8Vftyqhec1w8eVt/I+jNXyDLQpffXCeLfL/IG Hcz9KSf7pDg7vwsnYMEJj5IVy67qTPTxLnb8j9Bbls/Gh7Q4OapFmDNpTcv9nPGooB2s uobw== X-Gm-Message-State: AOAM5329pZ3Mqqz4TLntjcDJBj1RYh3tZ38EIX5B1eDDzQupEvgzSC+x SMeoPCeElHhbZH+20Mi51DU= X-Google-Smtp-Source: ABdhPJy4v5TikkhUYJq55taK5ixJclRgg/QJC6KEO7aFwFjYnGGQ2t2KKgz43WkuTIFqGMHRglm7SA== X-Received: by 2002:adf:d0c8:: with SMTP id z8mr4318502wrh.109.1639672442431; Thu, 16 Dec 2021 08:34:02 -0800 (PST) Received: from smtpclient.apple ([2a01:e34:ec28:8cb0:a5b9:b62:16cf:26bf]) by smtp.gmail.com with ESMTPSA id q206sm1252352wme.8.2021.12.16.08.34.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Dec 2021 08:34:01 -0800 (PST) From: FX Message-Id: Content-Type: multipart/mixed; boundary="Apple-Mail=_783A299A-D614-4347-8590-C4EFAF6E835E" Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.40.0.1.81\)) Subject: Re: [patch] Fix libfortran/101255, wrong IOSTAT value for FLUSH Date: Thu, 16 Dec 2021 17:34:01 +0100 In-Reply-To: <9a51d5ac-5b23-89fb-05f4-65b4a508d34e@gmx.de> Cc: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org To: Harald Anlauf References: <257551D4-BDAE-48D1-A91B-D2C59CC6CD96@gmail.com> <9a51d5ac-5b23-89fb-05f4-65b4a508d34e@gmx.de> X-Mailer: Apple Mail (2.3693.40.0.1.81) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Dec 2021 16:34:05 -0000 --Apple-Mail=_783A299A-D614-4347-8590-C4EFAF6E835E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii With correct patch attached, sorry. -------- Hi, Bug reported by Tobias at = https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101255 = Trivial fix, adding a testcase. Bootstrapped and regtested on x86_64-pc-linux-gnu. OK to commit? FX --Apple-Mail=_783A299A-D614-4347-8590-C4EFAF6E835E Content-Disposition: attachment; filename=pr101255.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="pr101255.patch" Content-Transfer-Encoding: 7bit commit 927ee72bf614d67ec077417039c202a22383c254 Author: Francois-Xavier Coudert Date: 2021-12-16 15:33:17 +0100 Fix FLUSH IOSTAT value PR libfortran/101255 libgfortran/ChangeLog: * io/file_pos.c: Fix error code. gcc/testsuite/ChangeLog: * gfortran.dg/iostat_5.f90: New file. diff --git a/gcc/testsuite/gfortran.dg/iostat_5.f90 b/gcc/testsuite/gfortran.dg/iostat_5.f90 new file mode 100644 index 00000000000..aa9d5f104e6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/iostat_5.f90 @@ -0,0 +1,16 @@ +! PR libfortran/101255 +! { dg-do run } + +program test + use ISO_FORTRAN_ENV, only: IOSTAT_EOR, IOSTAT_END + implicit none + character(len=50) :: err + integer :: i + + err = "" + flush(99, iostat=i, iomsg=err) + + if (err == "") call abort + if (i >= 0) call abort + if (i == IOSTAT_EOR .or. i == IOSTAT_END) call abort +end diff --git a/libgfortran/io/file_pos.c b/libgfortran/io/file_pos.c index 7e71ca577e0..4ed1698f17a 100644 --- a/libgfortran/io/file_pos.c +++ b/libgfortran/io/file_pos.c @@ -527,7 +527,7 @@ st_flush (st_parameter_filepos *fpp) } else /* FLUSH on unconnected unit is illegal: F95 std., 9.3.5. */ - generate_error (&fpp->common, LIBERROR_BAD_OPTION, + generate_error (&fpp->common, -LIBERROR_BAD_UNIT, "Specified UNIT in FLUSH is not connected"); if (needs_unlock) --Apple-Mail=_783A299A-D614-4347-8590-C4EFAF6E835E--