From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32540 invoked by alias); 7 Jun 2008 16:48:43 -0000 Received: (qmail 32373 invoked by uid 48); 7 Jun 2008 16:47:55 -0000 Date: Sat, 07 Jun 2008 16:48:00 -0000 Message-ID: <20080607164755.32372.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/36426] Endless loop in gfc_apply_interface_mapping_to_expr In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus 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: 2008-06/txt/msg00408.txt.bz2 ------- Comment #1 from burnus at gcc dot gnu dot org 2008-06-07 16:47 ------- Backtrace: in gfc_getmem (n=40) at gcc/fortran/misc.c:37 in gfc_get_interface_mapping_charlen at gcc/fortran/trans-expr.c:1485 in gfc_apply_interface_mapping_to_expr at gcc/fortran/trans-expr.c:1920 in gfc_apply_interface_mapping_to_expr at gcc/fortran/trans-expr.c:1955 [... last two lines repeat several times ...] in gfc_finish_interface_mapping at gcc/fortran/trans-expr.c:1695 in gfc_conv_function_call at gcc/fortran/trans-expr.c:2637 In gfc_apply_interface_mapping_to_expr, first a EXPR_FUNCTION with expr->name "__len_1_i4" is mapped; then a BT_CHARACTER EXPR_VARIABLE, then a function "__len_1_i4" then ... Line 1955 is: case EXPR_FUNCTION: for (actual = expr->value.function.actual; actual; actual = actual->next) gfc_apply_interface_mapping_to_expr (mapping, actual->expr); Line 1920 is: if (expr->ts.type == BT_CHARACTER && expr->ts.cl) { expr->ts.cl = gfc_get_interface_mapping_charlen (mapping, expr->ts.cl); * * * The essential part of the bug is that the length of the return value depends on the dummy argument. Reduced test: interface function foo(x) character(len=len(x)) :: foo,x end function foo end interface character(len=20) :: str str = foo("Hello") end Important is that both foo and x are "len(x)", if x has len=*, it works. At the end the call looks / should look like foo ((character(kind=1)[1:5] *) &str.1, 5, D.1017, 5); (as generated with "(len=*) :: x") -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Known to fail| |4.3.0 4.4.0 Summary|Compiling tiny prog: Stack |Endless loop in |overflow; uses PROCEDURE |gfc_apply_interface_mapping_ | |to_expr http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36426