From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23431 invoked by alias); 3 Jan 2008 17:59:24 -0000 Received: (qmail 22915 invoked by uid 48); 3 Jan 2008 17:58:06 -0000 Date: Thu, 03 Jan 2008 18:08:00 -0000 Message-ID: <20080103175806.22914.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/34640] ICE when assigning item of a derived-component to a pointer 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-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-01/txt/msg00218.txt.bz2 ------- Comment #5 from pault at gcc dot gnu dot org 2008-01-03 17:58 ------- I'm taking a look at how it might be done. This allows compilation to proceed: Index: gcc/fortran/trans-decl.c =================================================================== *** gcc/fortran/trans-decl.c (revision 131237) --- gcc/fortran/trans-decl.c (working copy) *************** gfc_get_symbol_decl (gfc_symbol * sym) *** 951,956 **** --- 951,970 ---- sym->backend_decl = decl; } + if (sym->attr.subref_array_pointer) + { + tree span; + GFC_DECL_SUBREF_ARRAY_P (sym->backend_decl) = 1; + span = build_decl (VAR_DECL, create_tmp_var_name ("span"), + gfc_array_index_type); + gfc_allocate_lang_decl (sym->backend_decl); + gfc_finish_var_decl (span, sym); + TREE_STATIC (span) = 1; + DECL_INITIAL (span) = build_int_cst (NULL_TREE, 0); + + GFC_DECL_SPAN (sym->backend_decl) = span; + } + TREE_USED (sym->backend_decl) = 1; if (sym->attr.assign && GFC_DECL_ASSIGN (sym->backend_decl) == 0) { but the span is not passed back to the actual argument, as this demonstrates: MODULE test IMPLICIT NONE TYPE :: my_type INTEGER :: value = 99 INTEGER :: spacer = 199 END TYPE CONTAINS SUBROUTINE get_values(values, d) INTEGER,POINTER :: values(:) TYPE(my_type),POINTER :: d(:) values => d(:)%value print *, "in get_values ", values END SUBROUTINE END MODULE use test TYPE(my_type),POINTER :: d(:) INTEGER,POINTER :: values(:) allocate (d(2)) call get_values (values, d) print *, "in MAIN ", values deallocate (d) end I'll have to figure out how this can be done. No doubt 'span' will have to be added to the parent scope and the assignment performed on function entry and return. Hmmm!! Better still would be to copy in and copy out. Back to PR34431 and friends - I'll do this next. Paul -- pault at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |WAITING http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34640