diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2008-01-08 15:12:34 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2008-01-08 15:12:34 +0000 |
commit | 3672065a1dc197ed785e6b1ffae1449621c5e3d2 (patch) | |
tree | be9570725d190ba3b7ea072d185fef893ed52e81 /gcc/fortran | |
parent | 8bce96f5a03f2a240c402550c158882f4bd93fd6 (diff) | |
download | gcc-3672065a1dc197ed785e6b1ffae1449621c5e3d2.zip gcc-3672065a1dc197ed785e6b1ffae1449621c5e3d2.tar.gz gcc-3672065a1dc197ed785e6b1ffae1449621c5e3d2.tar.bz2 |
re PR fortran/34681 (SAVEd derived type with allocatable components causes ICE)
2008-01-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/34681
* trans_array.c (gfc_trans_deferred_array): Do not null the
data pointer on entering scope, nor deallocate it on leaving
scope, if the symbol has the 'save' attribute.
PR fortran/34704
* trans_decl.c (gfc_finish_var_decl): Derived types with
allocatable components and an initializer must be TREE_STATIC.
2008-01-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/34681
PR fortran/34704
* gfortran.dg/alloc_comp_default_init_1.f90: New test.
From-SVN: r131395
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/fortran/trans-array.c | 4 | ||||
-rw-r--r-- | gcc/fortran/trans-decl.c | 3 |
3 files changed, 16 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 19f822f..dd2492d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,14 @@ +2008-01-08 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/34681 + * trans_array.c (gfc_trans_deferred_array): Do not null the + data pointer on entering scope, nor deallocate it on leaving + scope, if the symbol has the 'save' attribute. + + PR fortran/34704 + * trans_decl.c (gfc_finish_var_decl): Derived types with + allocatable components and an initializer must be TREE_STATIC. + 2008-01-07 Paul Thomas <pault@gcc.gnu.org> PR fortran/34672 diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 2ebb365..f8d9082 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -5527,7 +5527,7 @@ gfc_trans_deferred_array (gfc_symbol * sym, tree body) } /* NULLIFY the data pointer. */ - if (GFC_DESCRIPTOR_TYPE_P (type)) + if (GFC_DESCRIPTOR_TYPE_P (type) && !sym->attr.save) gfc_conv_descriptor_data_set (&fnblock, descriptor, null_pointer_node); gfc_add_expr_to_block (&fnblock, body); @@ -5545,7 +5545,7 @@ gfc_trans_deferred_array (gfc_symbol * sym, tree body) gfc_add_expr_to_block (&fnblock, tmp); } - if (sym->attr.allocatable) + if (sym->attr.allocatable && !sym->attr.save) { tmp = gfc_trans_dealloc_allocated (sym->backend_decl); gfc_add_expr_to_block (&fnblock, tmp); diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index f97870c..79a3e8b 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -525,6 +525,9 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym) SAVE_EXPLICIT. */ if (!sym->attr.use_assoc && (sym->attr.save != SAVE_NONE || sym->attr.data + || (sym->ts.type == BT_DERIVED + && sym->ts.derived->attr.alloc_comp + && sym->value) || (sym->value && sym->ns->proc_name->attr.is_main_program))) TREE_STATIC (decl) = 1; |