From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16741 invoked by alias); 29 Aug 2011 16:23:10 -0000 Received: (qmail 16706 invoked by uid 22791); 29 Aug 2011 16:23:05 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_SG,TW_TM X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 29 Aug 2011 16:22:51 +0000 From: "sgk at troutmask dot apl.washington.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/45170] [F2003] allocatable character lengths Date: Mon, 29 Aug 2011 16:32:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: sgk at troutmask dot apl.washington.edu X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-08/txt/msg02322.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45170 --- Comment #27 from Steve Kargl 2011-08-29 16:22:16 UTC --- On Mon, Aug 29, 2011 at 06:47:41AM +0000, burnus at gcc dot gnu.org wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45170 > > --- Comment #26 from Tobias Burnus 2011-08-29 06:47:41 UTC --- > (In reply to comment #24) > > Your code in comment #14 is (I believe) invalid, and gfortran > > is issuing the correct error message. > > I get: > Error: Variable 'length' cannot appear in the expression at (1) > > However, I believe that > allocate(character(len=length)::string) > is valid. > > One has (F2008): > R626 allocate-stmt is ALLOCATE ( [ type-spec :: ] allocation-list > [, alloc-opt-list ] ) > with > R402 type-spec is intrinsic-type-spec or derived-type-spec > with > R404 intrinsic-type-spec is [...] > or CHARACTER [ char-selector ] > with > R420 char-selector is length-selector [or ...] > with > R421 length-selector is ( [ LEN = ] type-param-value ) [or ...] > >>From F2003: C402 (R402) The type-param-value for a kind type parameter shall be an initialization expression. 7.1.7 An initialization expression is an expression with limitations that make it suitable for use as a kind type parameter, initializer, or named constant. It is an expression in which each operation is intrinsic, and each primary is (1) A constant or subobject of a constant, character(:),allocatable::string integer::length length=5 allocate(character(len=length)::string) length is not a constant.