From patchwork Sat Oct 15 19:07:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry DeLisle X-Patchwork-Id: 682586 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3sxDWB57Xhz9s9x for ; Sun, 16 Oct 2016 06:07:48 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=yeEx08mg; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=lg0D8s9cI1cgKm02CktaPZx8PHGEW2qDXmYozqWdSpPiSdH5nc Hl3sbpkZaeLiJ+HwB6NO6gg/x7/i0A9+FNV5pbV1tayaxnWL+UZ0Zm5J6WFqWzmg h+30EwnewglMCWAdcZcSCie196bMhDLIA/kUTo66l0iTSmznuz4Zt+BR4= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=tIm9a5UAU7PM0HidnF0EbM5ziiA=; b=yeEx08mg8udYuYnleWT3 Lp9KUPIctAblTT38nWlaahl+C2ILm3bmxiI7W7WqmobOd10pXUVeRyKsC5nL/Rr7 nlFvdw7yuxdokIRK0j0Ag65j1iWhGeUlM4uyQe5z40Aq+HBd6OcCtvGuQ80qGbxB cUasMyHECuzh8NIP32raj1U= Received: (qmail 80213 invoked by alias); 15 Oct 2016 19:07:38 -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 80192 invoked by uid 89); 15 Oct 2016 19:07:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=UNIT, READ, DTV, iostat X-Spam-User: qpsmtpd, 2 recipients X-HELO: mtaout004-public.msg.strl.va.charter.net Received: from mtaout004-public.msg.strl.va.charter.net (HELO mtaout004-public.msg.strl.va.charter.net) (68.114.190.29) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 15 Oct 2016 19:07:27 +0000 Received: from impout004 ([68.114.189.19]) by mtaout004.msg.strl.va.charter.net (InterMail vM.9.00.023.01 201-2473-194) with ESMTP id <20161015190725.DCNB3685.mtaout004.msg.strl.va.charter.net@impout004>; Sat, 15 Oct 2016 14:07:25 -0500 Received: from amda8.localdomain ([96.41.215.23]) by impout004 with charter.net id vv7P1t0040Wrkg001v7Pl3; Sat, 15 Oct 2016 14:07:25 -0500 X-Authority-Analysis: v=2.1 cv=cL9uszuN c=1 sm=1 tr=0 a=salB9WdMPIDduBH7JsZfrA==:117 a=salB9WdMPIDduBH7JsZfrA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=r77TgQKjGQsHNAKrUKIA:9 a=mDV3o1hIAAAA:8 a=VRvUcrm7dNsTVQlQX-AA:9 a=QEXdDO2ut3YA:10 a=TkRovQr0dBXA2zbCWfEA:9 a=_FVE-zBwftR9WsbkzFJk:22 X-Auth-id: anZkZWxpc2xlQGNoYXJ0ZXIubmV0 To: "fortran@gcc.gnu.org" Cc: GCC Patches From: Jerry DeLisle Subject: [Patch, fortran] Implement inquire(iolength= ) for DTIO Message-ID: Date: Sat, 15 Oct 2016 12:07:22 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 This very simple patch implements the subject feature. Fortran Standard draft F2016 states in 9.10.3.2: The output list in an INQUIRE statement shall not contain any derived-type list items that require a defined input/output procedure as described in subclause 9.6.3. If a derived-type list item appears in the output list, the value returned for the IOLENGTH= specifier assumes that no defined input/output procedure will be invoked. The language seems a little obscure. I think the first sentence means don't expect inquire to use a UDDTIO procedure and the second sentence says when you use a derived type that has UDDTIO procedures in the output list, treat them as if they don't and use the default derived type lengths. Regression tested on x86-64-linux. New test case attached. I will give this a day or two for comment. OK for trunk. Jerry 2016-10-15 Jerry DeLisle * trans-io.c (transfer_expr): Ignore dtio procedures for inquire with iolength. 2016-10-15 Jerry DeLisle * gfortran.dg/dtio_16.f90: New test. diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 3cdbf1fd..216317ad 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -2325,7 +2325,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, if (derived->attr.has_dtio_procs) arg2 = get_dtio_proc (ts, code, &dtio_sub); - if (dtio_sub != NULL) + if ((dtio_sub != NULL) && (last_dt != IOLENGTH)) { tree decl; decl = build_fold_indirect_ref_loc (input_location,