From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21379 invoked by alias); 7 Nov 2010 14:33:02 -0000 Received: (qmail 21365 invoked by uid 22791); 7 Nov 2010 14:33:02 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_JV 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; Sun, 07 Nov 2010 14:32:58 +0000 From: "jvdelisle at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/46331] Compilation time long with simple function in array constructor 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: jvdelisle at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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 Date: Sun, 07 Nov 2010 14:33:00 -0000 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: 2010-11/txt/msg00814.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46331 --- Comment #2 from Jerry DeLisle 2010-11-07 14:32:47 UTC --- Patch: The part removed too agressively decides if an expression is constant. In the case of rand(), the result obviously does not reduce to a constant but the array constructor was expanded. Returning zero here means the function is not constant and therefore the array is not expanded at compile time. Regression tested OK on x86-64. Index: expr.c =================================================================== --- expr.c (revision 166382) +++ expr.c (working copy) @@ -900,7 +900,6 @@ int gfc_is_constant_expr (gfc_expr *e) { gfc_constructor *c; - gfc_actual_arglist *arg; if (e == NULL) return 1; @@ -921,19 +920,8 @@ gfc_is_constant_expr (gfc_expr *e) /* Specification functions are constant. */ if (check_specification_function (e) == MATCH_YES) return 1; + return 0; - /* Call to intrinsic with at least one argument. */ - if (e->value.function.isym && e->value.function.actual) - { - for (arg = e->value.function.actual; arg; arg = arg->next) - if (!gfc_is_constant_expr (arg->expr)) - return 0; - - return 1; - } - else - return 0; - case EXPR_CONSTANT: case EXPR_NULL: return 1;