From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21397 invoked by alias); 30 Apr 2014 12:31:05 -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 Received: (qmail 21330 invoked by uid 48); 30 Apr 2014 12:30:59 -0000 From: "dominiq at lps dot ens.fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/43996] ICE in gfc_conv_array_initializer due to incomplete simplification of init expressions Date: Wed, 30 Apr 2014 12:31: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-Version: 4.6.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: dominiq at lps dot ens.fr X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-04/txt/msg02260.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43996 --- Comment #16 from Dominique d'Humieres --- The following patch fixes the ICE without reverting the fix for pr40472: --- ../_clean/gcc/fortran/simplify.c 2014-04-27 12:52:10.000000000 +0200 +++ gcc/fortran/simplify.c 2014-04-30 14:23:46.000000000 +0200 @@ -5939,7 +6021,8 @@ gfc_simplify_spread (gfc_expr *source, g else mpz_init_set_ui (size, 1); - if (mpz_get_si (size)*ncopies > gfc_option.flag_max_array_constructor) + if (!gfc_init_expr_flag + && mpz_get_si (size)*ncopies > gfc_option.flag_max_array_constructor) return NULL; if (source->expr_type == EXPR_CONSTANT) Indeed compiling the test in comment 8 gives Error: The number of elements in the array constructor at (1) requires an increase of the allowed 65535 upper limit. See -fmax-array-constructor option even if ", PARAMETER" is removed in the line INTEGER, PARAMETER :: C(N, N) = MATMUL(A, B) IMO the fix for SPREAD should be extended to all the intrinsics allowed for initialization.