From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45269 invoked by alias); 11 Aug 2017 00:15:01 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 38239 invoked by uid 89); 11 Aug 2017 00:14:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=sentry X-Spam-User: qpsmtpd, 3 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Aug 2017 00:14:45 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8D10214880F; Fri, 11 Aug 2017 00:14:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8D10214880F Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jwakely@redhat.com Received: from localhost (unknown [10.33.36.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33F8E5FCA1; Fri, 11 Aug 2017 00:14:44 +0000 (UTC) Date: Fri, 11 Aug 2017 03:04:00 -0000 From: Jonathan Wakely To: Paolo Carlini Cc: Andreas Schwab , libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org, dje@gcc.gnu.org Subject: Re: [PATCH] PR libstdc++/53984 handle exceptions in basic_istream::sentry Message-ID: <20170811001443.GT15340@redhat.com> References: <20170725204326.GA28500@redhat.com> <0adc99bb-152b-2cd3-9f42-467428e193d2@oracle.com> <1d403da3-7095-b6ef-d7be-433a82c2d2eb@oracle.com> <20170726220611.GV15340@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="tDYGg60iReQ7u8wj" Content-Disposition: inline In-Reply-To: <20170726220611.GV15340@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.8.0 (2017-02-23) X-SW-Source: 2017-08/txt/msg00775.txt.bz2 --tDYGg60iReQ7u8wj Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-length: 1032 On 26/07/17 23:06 +0100, Jonathan Wakely wrote: >On 26/07/17 20:14 +0200, Paolo Carlini wrote: >>Hi again, >> >>On 26/07/2017 16:27, Paolo Carlini wrote: >>>Hi, >>> >>>On 26/07/2017 16:21, Andreas Schwab wrote: >>>>ERROR: 27_io/basic_fstream/53984.cc: unknown dg option: >>>>dg-require-file-io 18 {} for " dg-require-file-io 18 "" " >>>Should be already fixed, a trivial typo. >>... but now the new test simply fails for me. If I don't spot >>something else trivial over the next few hours I guess better >>waiting for Jon to look into that. > >Sorry about that, I must have only checked for FAILs and missed the >ERRORs. > >It should have been an ifstream not fstream, otherwise the filebuf >can't even open the file. Fixed like so, committed to trunk. This FAILs on AIX, because reading from a directory with fread doesn't fail on AIX. This makes the test check whether reading fails, before trying to check the behaviour of formatted input functions that fail. Tested powerpc64le-linux and powerpc-aix, committed to trunk. --tDYGg60iReQ7u8wj Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" Content-length: 1475 commit bb7f3e33c3442f2d93134555bb74cf3ea2991710 Author: Jonathan Wakely Date: Thu Aug 10 22:02:17 2017 +0100 PR libstdc++/81808 skip test if reading directory doesn't fail PR libstdc++/81808 * testsuite/27_io/basic_fstream/53984.cc: Adjust test for targets that allow opening a directory as a FILE and reading from it. diff --git a/libstdc++-v3/testsuite/27_io/basic_fstream/53984.cc b/libstdc++-v3/testsuite/27_io/basic_fstream/53984.cc index e49d2b1..a319aff 100644 --- a/libstdc++-v3/testsuite/27_io/basic_fstream/53984.cc +++ b/libstdc++-v3/testsuite/27_io/basic_fstream/53984.cc @@ -17,6 +17,8 @@ // { dg-require-fileio "" } +// PR libstdc++/53984 + #include #include @@ -26,9 +28,32 @@ test01() std::ifstream in("."); if (in) { + char c; + if (in.get(c)) + { + // Reading a directory doesn't produce an error on this target + // so the formatted input functions below wouldn't fail anyway + // (see PR libstdc++/81808). + return; + } int x; + in.clear(); + // Formatted input function should set badbit, but not throw: in >> x; VERIFY( in.bad() ); + + in.clear(); + in.exceptions(std::ios::badbit); + try + { + // Formatted input function should set badbit, and throw: + in >> x; + VERIFY( false ); + } + catch (const std::exception&) + { + VERIFY( in.bad() ); + } } } --tDYGg60iReQ7u8wj--