From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26133 invoked by alias); 18 Sep 2006 06:53:31 -0000 Received: (qmail 26112 invoked by uid 48); 18 Sep 2006 06:53:23 -0000 Date: Mon, 18 Sep 2006 06:53:00 -0000 Message-ID: <20060918065323.26111.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/29101] Memory leak in gfortran In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pault at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-09/txt/msg01668.txt.bz2 List-Id: ------- Comment #3 from pault at gcc dot gnu dot org 2006-09-18 06:53 ------- (In reply to comment #2) > Problem is not in library side. > Jerry, This is an easy one: Somebody forgot to add the post block for the evaluation of the select expression to the block of code, for the specific case of character expressions. This Index: gcc/fortran/trans-stmt.c =================================================================== *** gcc/fortran/trans-stmt.c (revision 117013) --- gcc/fortran/trans-stmt.c (working copy) *************** gfc_trans_character_select (gfc_code *co *** 1467,1472 **** --- 1467,1474 ---- tmp = build1 (GOTO_EXPR, void_type_node, tmp); gfc_add_expr_to_block (&block, tmp); + gfc_add_block_to_block (&block, &se.post); + tmp = gfc_finish_block (&body); gfc_add_expr_to_block (&block, tmp); tmp = build1_v (LABEL_EXPR, end_label); fixes it by producing the code: pstr.6 = (char[1:D.960] *) _gfortran_internal_malloc (D.960); tolower (pstr.6, D.960, D.958, D.959); goto _gfortran_select_string ((void *) &jumptable.5, 2, &L.5, pstr.6, D.960); _gfortran_internal_free ((void *) pstr.6); L.4:; *value = 1; goto L.5; L.3:; __result_validate_value = 0; goto L.5; L.5:; I am not going to be in a position to do anything about this for two weeks - "I'm on the road again...". I can submit it today; if it is determined to be essential to get into the 4.2 release, could you do the honors with the commit? Are there any more such constructs in fortran that take a character expression? I could not immediately think of any. Paul -- pault at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jvdelisle at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29101