From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13844 invoked by alias); 1 Jul 2010 06:21:55 -0000 Received: (qmail 13789 invoked by uid 48); 1 Jul 2010 06:21:39 -0000 Date: Thu, 01 Jul 2010 06:21:00 -0000 Message-ID: <20100701062139.13788.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/44735] ICE on FORALL with character array pointer 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/msg00012.txt.bz2 ------- Comment #1 from burnus at gcc dot gnu dot org 2010-07-01 06:21 ------- Confirm. Valgrind shows: ==11328== Invalid read of size 8 ==11328== at 0x6CBB86: fold_convert_loc (fold-const.c:1856) ==11328== by 0x58E7A3: allocate_temp_for_forall_nest_1 (trans-stmt.c:2583) ==11328== by 0x58F394: gfc_trans_assign_need_temp (trans-stmt.c:2702) ==11328== by 0x59284C: gfc_trans_forall_1 (trans-stmt.c:3158) ==11328== by 0x551DFF: trans_code (trans.c:1205) Failing is the following line in fold-const.c tree orig = TREE_TYPE (arg); which is the second argument in the following line of allocate_temp_for_forall_nest_1: unit = fold_convert (gfc_array_index_type, TYPE_SIZE_UNIT (type)); It is set in gfc_trans_assign_need_temp: if (expr1->ts.type == BT_CHARACTER && expr1->ts.u.cl->length) ... else type = gfc_typenode_for_spec (&expr1->ts); For the example, expr1->ts.type == BT_CHARACTER but expr1->ts.u.cl->length == NULL. The symbol itself has: (gdb) p *expr1->symtree->n.sym->ts.u.cl->length->value.integer._mp_d $8 = 10 And the size is given by the expression: (gdb) p expr1->ref->u.ss.start->expr_type $19 = EXPR_VARIABLE -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |ice-on-valid-code Known to fail| |4.3.4 4.4.0 4.5.1 4.6.0 Last reconfirmed|0000-00-00 00:00:00 |2010-07-01 06:21:38 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44735