From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23489 invoked by alias); 27 Jul 2010 09:50:11 -0000 Received: (qmail 23309 invoked by uid 48); 27 Jul 2010 09:49:57 -0000 Date: Tue, 27 Jul 2010 09:50:00 -0000 Message-ID: <20100727094957.23308.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/45077] ICE with -fwhole-file in fold_convert_loc, at fold-const.c:2021 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: 2010-07/txt/msg02950.txt.bz2 ------- Comment #1 from burnus at gcc dot gnu dot org 2010-07-27 09:49 ------- Reduced test case: !------------------------------------------------------------------ module iso_red type, public :: varying_string character(LEN=1), dimension(:), allocatable :: chars end type varying_string end module iso_red module ifiles use iso_red, string_t => varying_string contains function line_get_string_advance (line) result (string) type(string_t) :: string character :: line end function line_get_string_advance end module ifiles module syntax_rules use iso_red, string_t => varying_string use ifiles, only: line_get_string_advance contains subroutine syntax_init_from_ifile () type(string_t) :: string string = line_get_string_advance ("") end subroutine syntax_init_from_ifile end module syntax_rules end !------------------------------------------------------------------ The ICE occurs for: gfc_trans_assignment (trans-expr.c:5561) gfc_trans_assignment_1 (trans-expr.c:5419) gfc_trans_scalar_assign (trans-expr.c:4909) fold_convert_loc (fold-const.c:2021) The fancy_abort occurs because TREE_CODE (type) is gcc_unreachable, type is the second argument. The call is: gfc_add_modify (&block, lse->expr, fold_convert (TREE_TYPE (lse->expr), rse->expr)); Namely "TREE_TYPE (lse->expr)" as "location_t" is added as first via #define. Hereby LHS is variable "string" and RHS is function "line_get_string_advance". Both have the same type: expr1->ts.u.derived->name == "varying_string" and point to the _same_ expr2->ts.u.derived->backend_decl. However, the data type looks different at TREE_TYPE, i.e. lse->expr.common.type != rse->expr.common.type My working theory is that one generates a different back-end decl for type(varying_string) and type(string_t). However, ts.u.derived->backend_decl is the same - and as ts.type.derived->components{,->ts.u.cl}->backend_decl is the same, I am not sure whether this theory is correct. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45077