From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9551 invoked by alias); 4 May 2007 05:42:31 -0000 Received: (qmail 9522 invoked by uid 48); 4 May 2007 05:42:23 -0000 Date: Fri, 04 May 2007 05:42:00 -0000 Message-ID: <20070504054223.9521.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/31251] Non-integer character length leads to segfault In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jvdelisle at gcc dot gnu dot org" 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: 2007-05/txt/msg00328.txt.bz2 ------- Comment #9 from jvdelisle at gcc dot gnu dot org 2007-05-04 06:42 ------- I think the problem may be in arith.c (gfc_constant_result). We are passing a type real into this and so we do not mpz_init (result->value.integer); Which we later try to set at simplify.c: 2143 mpz_set (result->value.integer, e->ts.cl->length->value.integer); And it breaks sometimes. As I said, I can not reproduce the bug, but this is my look into it for what its worth. You might try this and see what it does: Index: arith.c =================================================================== --- arith.c (revision 124405) +++ arith.c (working copy) @@ -420,6 +420,7 @@ gfc_constant_result (bt type, int kind, case BT_REAL: gfc_set_model_kind (kind); + mpz_init (result->value.integer); mpfr_init (result->value.real); break; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31251