aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-decl.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2006-11-09 18:42:28 +0000
committerPaul Thomas <pault@gcc.gnu.org>2006-11-09 18:42:28 +0000
commit7114edca021e3251ec74acf93e9ebe18b128c87a (patch)
tree24d34b4ba251e9f21674a4a86c639715a08502f3 /gcc/fortran/trans-decl.c
parentd82a02fa4f3cd88f8d8f080ffe4bd9c7536c7e8f (diff)
downloadgcc-7114edca021e3251ec74acf93e9ebe18b128c87a.zip
gcc-7114edca021e3251ec74acf93e9ebe18b128c87a.tar.gz
gcc-7114edca021e3251ec74acf93e9ebe18b128c87a.tar.bz2
re PR fortran/29699 (ICE in trans-decl.c)
2006-11-09 Paul Thomas <pault@gcc.gnu.org> PR fortran/29699 * trans-array.c (structure_alloc_comps): Detect pointers to arrays and use indirect reference to declaration. * resolve.c (resolve_fl_variable): Tidy up condition. (resolve_symbol): The same and only add initialization code if the symbol is referenced. * trans-decl.c (gfc_trans_deferred_vars): Call gfc_trans_ deferred_array before gfc_trans_auto_array_allocation. PR fortran/21730 * symbol.c (check_done): Remove. (gfc_add_attribute): Remove reference to check_done and remove the argument attr_intent. (gfc_add_allocatable, gfc_add_dimension, gfc_add_external, gfc_add_intrinsic, gfc_add_optional, gfc_add_pointer, gfc_add_cray_pointer, gfc_add_cray_pointee, gfc_add_result, gfc_add_target, gfc_add_in_common, gfc_add_elemental, gfc_add_pure, gfc_add_recursive, gfc_add_procedure, gfc_add_type): Remove references to check_done. * decl.c (attr_decl1): Eliminate third argument in call to gfc_add_attribute. * gfortran.h : Change prototype for gfc_add_attribute. 2006-11-09 Paul Thomas <pault@gcc.gnu.org> PR fortran/29699 * gfortran.dg/alloc_comp_auto_array_1.f90: New test. PR fortran/21730 * gfortran.dg/change_symbol_attributes_1.f90: New test. From-SVN: r118624
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r--gcc/fortran/trans-decl.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 262c1a0..1a916cc 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -2591,6 +2591,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, tree fnbody)
gfc_symbol *sym;
gfc_formal_arglist *f;
stmtblock_t body;
+ bool seen_trans_deferred_array = false;
/* Deal with implicit return variables. Explicit return variables will
already have been added. */
@@ -2647,10 +2648,19 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, tree fnbody)
if (TREE_STATIC (sym->backend_decl))
gfc_trans_static_array_pointer (sym);
else
- fnbody = gfc_trans_deferred_array (sym, fnbody);
+ {
+ seen_trans_deferred_array = true;
+ fnbody = gfc_trans_deferred_array (sym, fnbody);
+ }
}
else
{
+ if (sym_has_alloc_comp)
+ {
+ seen_trans_deferred_array = true;
+ fnbody = gfc_trans_deferred_array (sym, fnbody);
+ }
+
gfc_get_backend_locus (&loc);
gfc_set_backend_locus (&sym->declared_at);
fnbody = gfc_trans_auto_array_allocation (sym->backend_decl,
@@ -2676,14 +2686,14 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, tree fnbody)
break;
case AS_DEFERRED:
- if (!sym_has_alloc_comp)
- fnbody = gfc_trans_deferred_array (sym, fnbody);
+ seen_trans_deferred_array = true;
+ fnbody = gfc_trans_deferred_array (sym, fnbody);
break;
default:
gcc_unreachable ();
}
- if (sym_has_alloc_comp)
+ if (sym_has_alloc_comp && !seen_trans_deferred_array)
fnbody = gfc_trans_deferred_array (sym, fnbody);
}
else if (sym_has_alloc_comp)