From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54266 invoked by alias); 15 Jan 2016 20:44:38 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 54235 invoked by uid 89); 15 Jan 2016 20:44:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=endeavour, uncertain, interval, five X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-oi0-f42.google.com Received: from mail-oi0-f42.google.com (HELO mail-oi0-f42.google.com) (209.85.218.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 15 Jan 2016 20:44:35 +0000 Received: by mail-oi0-f42.google.com with SMTP id p187so125000381oia.2; Fri, 15 Jan 2016 12:44:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=UhHRazNXw+79JARsbCVJziY7AIO6eS7hKJCGpgB4Z4E=; b=MAsmguHEnoIWSfgsAE/DvlsFoZH9JJfJYPUwtwmb0itRzJ/Oh4srpFOxoaRMEEehWJ ExybkugAbIss9aT42p7wCECecrE/DK2KSh+A3VNbY/VCO/mh9IuXZTWfnvE11piCC0UZ SK2ceS7WWtJqYHJowVN6CiuWBVN9qvPwM2nv2c4UqKKSqRnDb/T/iHP6+xpipqgEwo1k QhhOdvG2U7a35H4HShIfkHttL2JmP//KF3Y5LPwmfpeLLF39u9rLCRR98n23ARmc+IAW b46W7cjs+sf5+dirCxfDn0up6z1IGhvWRSlGwBHufRdyXpbfj2lNDh12OqalsHolh2Tf /R+g== X-Gm-Message-State: ALoCoQkeuU0pCDMQ5ethTJsn2pN/6vGkExmMlnfTUiEENhouwQsrveJFYFYSYHc8PvSbpiZx4W2i1sMrJyvA3tME7HXpZ4WeYA== MIME-Version: 1.0 X-Received: by 10.202.64.8 with SMTP id n8mr9640918oia.112.1452890673873; Fri, 15 Jan 2016 12:44:33 -0800 (PST) Received: by 10.202.175.19 with HTTP; Fri, 15 Jan 2016 12:44:33 -0800 (PST) In-Reply-To: References: Date: Fri, 15 Jan 2016 20:44:00 -0000 Message-ID: Subject: Re: [Patch, fortran] Bug 68241 - [meta-bug] Deferred-length character - PRs49630, 54070, 60593, 60795, 61147, 63232 and 64324 From: Paul Richard Thomas To: "fortran@gcc.gnu.org" , gcc-patches Cc: Steve Kargl , Damian Rouson , Dominique Dhumieres Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016-01/txt/msg00047.txt.bz2 Dear All, Following an exchange with Dominique on #gfortran, I fixed PR54070 comment #23. The changes are in trans-array.c and are listed in the ChangeLogs below. Committed to trunk as revision 232450. I will wait some weeks before committing to 5-branch. This patch should have made deferred character length a rather more usable feature. They still don't work in common blocks (PR55735) and there are still problems with them as associate variables (PR60458). I will endeavour to fix these PRs next. Thanks, Dominique! Paul On 9 January 2016 at 20:33, Paul Richard Thomas wrote: > Dear All, > > This is a further instalment of deferred character length fixes. I > have listed the status of all the deferred length PRs that I know of > in an attachment. As far as I can see, there are five left that are > really concerned with deferred character length functionality. > > In terms of the number of PRs fixed, this patch is rather less > impressive than it looks. Essentially four things have been fixed: > (i) Deferred character length results are passed by reference and so, > within the procedure itself, they are consistently indirectly > referenced; > (ii) The deferred character types are made correctly by indirectly > referencing the character length; > (iii) Array references to deferred character arrays use pointer arithmetic; and > (iv) Scalar assignments to unallocated arrays are trapped at runtime > with -fcheck=mem. > > A minor tweak was required to fix PR64324 because deferred length > characters were being misidentified as assumed length. > > The ChangeLog is clear as to what has been done. The only point on > which I am uncertain is that of making the length parameter of > deferred character length procedure results TREE_STATIC. This was > required to make the patch function correctly at any level of > optimization. Is this the best and/or only way of doing this? > > Bootstrapped and regtested on FC21/x86_64 - OK for trunk and, after a > decent interval, 5 branch? > > Cheers > > Paul > > 2016-01-09 Paul Thomas > > PR fortran/64324 > * resolve.c (check_uop_procedure): Prevent deferred length > characters from being trapped by assumed length error. > > PR fortran/49630 > PR fortran/54070 > PR fortran/60593 > PR fortran/60795 > PR fortran/61147 > PR fortran/64324 > * trans-array.c (gfc_conv_scalarized_array_ref): Pass decl for > function as well as variable expressions. > * trans.c (gfc_build_array_ref): Expand logic for setting span > to include indirect references to character lengths. > * trans-decl.c (gfc_get_symbol_decl): Ensure that deferred > result char lengths that are PARM_DECLs are indirectly > referenced both for directly passed and by reference. > (create_function_arglist): If the length type is a pointer type > then store the length as the 'passed_length' and make the char > length an indirect reference to it. > (gfc_trans_deferred_vars): If a character length has escaped > being set as an indirect reference, return it via the 'passed > length'. > * trans-expr.c (gfc_conv_procedure_call): The length of > deferred character length results is set TREE_STATIC and set to > zero. > (gfc_trans_assignment_1): Do not fix the rse string_length if > it is a variable, a parameter or an indirect reference. Add the > code to trap assignment of scalars to unallocated arrays. > * trans-stmt.c (gfc_trans_allocate): Remove 'def_str_len' and > all references to it. Instead, replicate the code to obtain a > explicitly defined string length and provide a value before > array allocation so that the dtype is correctly set. > trans-types.c (gfc_get_character_type): If the character length > is a pointer, use the indirect reference. > > 2016-01-09 Paul Thomas > > PR fortran/49630 > * gfortran.dg/deferred_character_13.f90: New test for the fix > of comment 3 of the PR. > > PR fortran/54070 > * gfortran.dg/deferred_character_8.f90: New test > * gfortran.dg/allocate_error_5.f90: New test > > PR fortran/60593 > * gfortran.dg/deferred_character_10.f90: New test > > PR fortran/60795 > * gfortran.dg/deferred_character_14.f90: New test > > PR fortran/61147 > * gfortran.dg/deferred_character_11.f90: New test > > PR fortran/64324 > * gfortran.dg/deferred_character_9.f90: New test -- The difference between genius and stupidity is; genius has its limits. Albert Einstein