From patchwork Tue Dec 18 19:45:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 207189 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]) by ozlabs.org (Postfix) with SMTP id 1C25D2C0093 for ; Wed, 19 Dec 2012 06:46:12 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1356464773; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=y+s9QloYXbizPQmd4Lch hY12SU0=; b=QStC//fp44q/CLobOka8Ac0d5nevPxxpb9ANeSrm+/hPgbDX9buF fWXb8E/Wm6rrea2IcgrolKToiy/hB+mRLuCenOrdTC2zP/lgNBD4pPF5FY/GXJLP EbIeYUlcuTAgsfXbgaoExLxwlt2fOrSYeqCxh18TwmpkFN0Hkd9EiMQ= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=XYoezgrkpnJPfdYk5/QMyRx5HBv0yT2FlHzc0df7H0asFDP07Lz6B3gmSayIAq s4dsi7AZxo5dmG1ET7rX2vh6paxpGfoQJOSVKpim1AO/q4+5H2qpVq5qLHIYJAn7 WLMa7sE28WqudZ1XE+qfb/MQ2WH86EupYMKApg/pytl4s=; Received: (qmail 32445 invoked by alias); 18 Dec 2012 19:45:58 -0000 Received: (qmail 32428 invoked by uid 22791); 18 Dec 2012 19:45:56 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 18 Dec 2012 19:45:52 +0000 Received: from archimedes.net-b.de (port-92-195-17-106.dynamic.qsc.de [92.195.17.106]) by mx02.qsc.de (Postfix) with ESMTP id 79B9327644; Tue, 18 Dec 2012 20:45:50 +0100 (CET) Message-ID: <50D0C7ED.7020809@net-b.de> Date: Tue, 18 Dec 2012 20:45:49 +0100 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Jakub Jelinek CC: Janus Weil , David Edelsohn , Fortran List , Paul Richard Thomas , GCC Patches Subject: Re: [Fortran, (RFC) patch] PR49110/51055 Assignment to alloc. deferred-length character vars References: <20121210100501.GG2315@tucnak.redhat.com> <20121210155439.GI2315@tucnak.redhat.com> <20121211120420.GN2315@tucnak.redhat.com> <20121211183753.GV2315@tucnak.redhat.com> <50D08E5A.80009@net-b.de> <20121218162809.GQ2315@tucnak.redhat.com> In-Reply-To: <20121218162809.GQ2315@tucnak.redhat.com> 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 Jakub Jelinek wrote: > On Tue, Dec 18, 2012 at 04:40:10PM +0100, Tobias Burnus wrote: >> Looks mostly okay, however, I fear that for >> >> subroutine foo() >> character(len=:), allocatable :: str >> allocate(str, stat=istat) >> end subroutine foo >> >> compiled with "-fno-automatic", gfortran will still generate the >> non-GFC_PREFIX-mangled string. > That doesn't compile: > Error: Allocate-object at (1) with a deferred type parameter requires either a type-spec or SOURCE tag or a MOLD tag Sorry for the bad example. I added the allocate just to mark the variable as used (otherwise no decl is generated); but my cut-down example was wrong. Try: subroutine foo() character(len=:), allocatable :: str print *, allocated(str) end subroutine foo Or one of the examples from PR55733. The example above gives currently (w/o your patch): static character(kind=1)[1:.str] * str = 0B; integer(kind=4) .str; > Where would be TREE_STATIC set on the length variable with -fno-automatic, > and on which testcase? As written, TREE_STATIC is currently not set (which is a bug, cf. PR55733); I think one needs a patch like: Tobias --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1107,3 +1107,4 @@ gfc_create_string_length (gfc_symbol * sym) - if (sym->attr.save || sym->ns->proc_name->attr.flavor == FL_MODULE) + if (sym->attr.save || sym->ns->proc_name->attr.flavor == FL_MODULE + || gfc_option.flag_max_stack_var_size == 0) TREE_STATIC (length) = 1;