diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 86f06624859..189dba0ea35 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,16 @@ +2009-07-25 Richard Guenther + + PR fortran/40005 + * trans-types.c (gfc_get_array_type_bounds): Use + build_distinct_type_copy with a proper TYPE_CANONICAL and + re-use the type-decl of the original type. + * trans-decl.c (build_entry_thunks): Signal cgraph we may not + garbage collect. + (create_main_function): Likewise. + (gfc_generate_function_code): Likewise. + * trans-expr.c (gfc_trans_subcomponent_assign): Do not use + fold_convert on record types. + 2009-07-25 Janus Weil PR fortran/39630 diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index b70d0bd235e..e4ac20f58b2 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -2032,7 +2032,7 @@ build_entry_thunks (gfc_namespace * ns) current_function_decl = NULL_TREE; - cgraph_finalize_function (thunk_fndecl, false); + cgraph_finalize_function (thunk_fndecl, true); /* We share the symbols in the formal argument list with other entry points and the master function. Clear them so that they are @@ -4114,7 +4114,7 @@ create_main_function (tree fndecl) /* Output the GENERIC tree. */ dump_function (TDI_original, ftn_main); - cgraph_finalize_function (ftn_main, false); + cgraph_finalize_function (ftn_main, true); if (old_context) { @@ -4385,7 +4385,7 @@ gfc_generate_function_code (gfc_namespace * ns) added to our parent's nested function list. */ (void) cgraph_node (fndecl); else - cgraph_finalize_function (fndecl, false); + cgraph_finalize_function (fndecl, true); gfc_trans_use_stmts (ns); gfc_traverse_ns (ns, gfc_emit_parameter_debug_info); diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 03902420e04..9bec2e10513 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -3763,9 +3763,7 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr) se.want_pointer = 0; gfc_conv_expr_descriptor (&se, expr, rss); gfc_add_block_to_block (&block, &se.pre); - - tmp = fold_convert (TREE_TYPE (dest), se.expr); - gfc_add_modify (&block, dest, tmp); + gfc_add_modify (&block, dest, se.expr); if (cm->ts.type == BT_DERIVED && cm->ts.derived->attr.alloc_comp) tmp = gfc_copy_alloc_comp (cm->ts.derived, se.expr, dest, diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index e85ab7c4a0a..99967ce3705 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -1602,7 +1602,9 @@ gfc_get_array_type_bounds (tree etype, int dimen, tree * lbound, int n; base_type = gfc_get_array_descriptor_base (dimen); - fat_type = build_variant_type_copy (base_type); + fat_type = build_distinct_type_copy (base_type); + TYPE_CANONICAL (fat_type) = base_type; + TYPE_STUB_DECL (fat_type) = TYPE_STUB_DECL (base_type); tmp = TYPE_NAME (etype); if (tmp && TREE_CODE (tmp) == TYPE_DECL)