aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-07-25 13:44:57 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-07-25 13:44:57 +0000
commit9618fb3c1bf9bf211109d87c435804f164202bda (patch)
treef31a521b266ab7c2fc65803ebeda79fb66969e8f
parent90661f261cdf7b2349d403c4669e0107faad310e (diff)
downloadgcc-9618fb3c1bf9bf211109d87c435804f164202bda.zip
gcc-9618fb3c1bf9bf211109d87c435804f164202bda.tar.gz
gcc-9618fb3c1bf9bf211109d87c435804f164202bda.tar.bz2
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
-rw-r--r--gcc/fortran/ChangeLog13
-rw-r--r--gcc/fortran/trans-decl.c6
-rw-r--r--gcc/fortran/trans-expr.c4
-rw-r--r--gcc/fortran/trans-types.c4
4 files changed, 20 insertions, 7 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 86f0662..189dba0 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index b70d0bd..e4ac20f 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 0390242..9bec2e1 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 e85ab7c..99967ce 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)