From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 699 invoked by alias); 20 Jul 2010 21:39:26 -0000 Received: (qmail 675 invoked by uid 22791); 20 Jul 2010 21:39:25 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,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, 20 Jul 2010 21:39:20 +0000 Received: from [192.168.178.22] (port-92-204-52-63.dynamic.qsc.de [92.204.52.63]) by mx02.qsc.de (Postfix) with ESMTP id 2EF461E7FA; Tue, 20 Jul 2010 23:39:17 +0200 (CEST) Message-ID: <4C461784.5020801@net-b.de> Date: Tue, 20 Jul 2010 21:39:00 -0000 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.10) Gecko/20100520 SUSE/3.0.5 Thunderbird/3.0.5 MIME-Version: 1.0 To: Janus Weil CC: gfortran , gcc-patches Subject: Re: [Patch, Fortran, OOP] PR 44962: [OOP] ICE with specification expression SIZE() References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2010-07/txt/msg01607.txt.bz2 Janus Weil wrote: > 2010-07-18 Janus Weil > > PR fortran/44962 > * array.c (resolve_array_bound): Modify error message. > * resolve.c (resolve_fl_derived): Call gfc_resolve_array_spec. > These two changes are OK. > * expr.c (gfc_is_constant_expr): Detect RAND() and IRAND() as > non-constant. > > 3) In gfc_is_constant_expr, I'm adding a special case for the RAND() > and IRAND() intrinsic functions, which were detected to be constant > before. [I'm assuming that a "constant expression" is something that > can be reduced to a constant at compile time, which the random > functions are clearly not.] > Frankly, I do not quite understand the check. I know a) "initialization expressions", which in Fortran 90 and 2008 are called "constant expressions", i.e. something which can be reduced at compile time to a number or string (or an array (constructor) of those). b) "Specification expressions", which do not need to be constant, but which need to fulfil some criteria (pureness etc.) Howver, I have not quite understood how this maps to expr.c's init/restricted/specification/constant expressions. Especially, I would expect that gfc_is_constant_expr match an expression yielding a constant. However, this does not seem to be the case as specification expressions are allowed. The check for intrinsic functions I also do not understand. The comment states that a simplified expression is required. However, if the intrinsic can be simplified, only has a simple number - and no EXPR_FUNCTION any more. And if not, well, then the check of the arguments does also not help. Tobias