From patchwork Fri Aug 11 00:14:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 800368 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-460212-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="BmUG3Nwp"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xT5BY1r5fz9sNV for ; Fri, 11 Aug 2017 10:15:47 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=IGWqERMDazYj5EaWr 5/MznFu6/gREkJeurPqGOYWHOSp7Lkl8v5vjMkVExBLYVqxHBC9cGrZbzSaeIRw7 jMS3L/bv1OpB0hjHE2CQmoDk8aruZD987Ceh47sdrsEaMICtc2LI4MQTV0SlvbTU 8FVg8AkxOCXuEmfahAM9PzBY2s= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=/weGR5MBTzIC4PBEttDAlx+ CLYk=; b=BmUG3NwpRXsky76Z0NvqN50s4Acmw//EVH5OGMuhnwwLl4i6fX5j6c9 jxk3PDnzexOcUEI10KSvIHhrdCXAM7Ok+RS8MkD+j74MSKart/geNUCn7pmm2xOF bgpZ1mXvv/Rj2k6YPmGVnqn/zImZhzZEGfNNJLIlFStJzkaWdQ0c= 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-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@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 01:14:43 +0100 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-Disposition: inline In-Reply-To: <20170726220611.GV15340@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.8.0 (2017-02-23) 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. 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() ); + } } }