re PR fortran/40005 (segfault in gt_ggc_mx_lang_tree_node)

2009-07-25  Richard Guenther  <rguenther@suse.de>

	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.

From-SVN: r150079
This commit is contained in:
Richard Guenther 2009-07-25 13:44:57 +00:00 committed by Richard Biener
parent 90661f261c
commit 9618fb3c1b
4 changed files with 20 additions and 7 deletions

View file

@ -1,3 +1,16 @@
2009-07-25 Richard Guenther <rguenther@suse.de>
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 <janus@gcc.gnu.org>
PR fortran/39630

View file

@ -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);

View file

@ -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,

View file

@ -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)