Commit 9618fb3c by Richard Guenther Committed by Richard Biener

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
parent 90661f26
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> 2009-07-25 Janus Weil <janus@gcc.gnu.org>
PR fortran/39630 PR fortran/39630
......
...@@ -2032,7 +2032,7 @@ build_entry_thunks (gfc_namespace * ns) ...@@ -2032,7 +2032,7 @@ build_entry_thunks (gfc_namespace * ns)
current_function_decl = NULL_TREE; 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 /* We share the symbols in the formal argument list with other entry
points and the master function. Clear them so that they are points and the master function. Clear them so that they are
...@@ -4114,7 +4114,7 @@ create_main_function (tree fndecl) ...@@ -4114,7 +4114,7 @@ create_main_function (tree fndecl)
/* Output the GENERIC tree. */ /* Output the GENERIC tree. */
dump_function (TDI_original, ftn_main); dump_function (TDI_original, ftn_main);
cgraph_finalize_function (ftn_main, false); cgraph_finalize_function (ftn_main, true);
if (old_context) if (old_context)
{ {
...@@ -4385,7 +4385,7 @@ gfc_generate_function_code (gfc_namespace * ns) ...@@ -4385,7 +4385,7 @@ gfc_generate_function_code (gfc_namespace * ns)
added to our parent's nested function list. */ added to our parent's nested function list. */
(void) cgraph_node (fndecl); (void) cgraph_node (fndecl);
else else
cgraph_finalize_function (fndecl, false); cgraph_finalize_function (fndecl, true);
gfc_trans_use_stmts (ns); gfc_trans_use_stmts (ns);
gfc_traverse_ns (ns, gfc_emit_parameter_debug_info); gfc_traverse_ns (ns, gfc_emit_parameter_debug_info);
......
...@@ -3763,9 +3763,7 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr) ...@@ -3763,9 +3763,7 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr)
se.want_pointer = 0; se.want_pointer = 0;
gfc_conv_expr_descriptor (&se, expr, rss); gfc_conv_expr_descriptor (&se, expr, rss);
gfc_add_block_to_block (&block, &se.pre); gfc_add_block_to_block (&block, &se.pre);
gfc_add_modify (&block, dest, se.expr);
tmp = fold_convert (TREE_TYPE (dest), se.expr);
gfc_add_modify (&block, dest, tmp);
if (cm->ts.type == BT_DERIVED && cm->ts.derived->attr.alloc_comp) if (cm->ts.type == BT_DERIVED && cm->ts.derived->attr.alloc_comp)
tmp = gfc_copy_alloc_comp (cm->ts.derived, se.expr, dest, tmp = gfc_copy_alloc_comp (cm->ts.derived, se.expr, dest,
......
...@@ -1602,7 +1602,9 @@ gfc_get_array_type_bounds (tree etype, int dimen, tree * lbound, ...@@ -1602,7 +1602,9 @@ gfc_get_array_type_bounds (tree etype, int dimen, tree * lbound,
int n; int n;
base_type = gfc_get_array_descriptor_base (dimen); 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); tmp = TYPE_NAME (etype);
if (tmp && TREE_CODE (tmp) == TYPE_DECL) if (tmp && TREE_CODE (tmp) == TYPE_DECL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment