diff options
author | Paul Brook <paul@codesourcery.com> | 2005-06-22 15:34:02 +0000 |
---|---|---|
committer | Paul Brook <pbrook@gcc.gnu.org> | 2005-06-22 15:34:02 +0000 |
commit | bd83e6142dc74cf26dca197f913bc38fe7b16b3a (patch) | |
tree | c40015daaa3be3a17b5b0f68506e33222a524d9b /gcc/fortran/symbol.c | |
parent | aacb35127936fd17dd160595f59fca6cd2b81b0e (diff) | |
download | gcc-bd83e6142dc74cf26dca197f913bc38fe7b16b3a.zip gcc-bd83e6142dc74cf26dca197f913bc38fe7b16b3a.tar.gz gcc-bd83e6142dc74cf26dca197f913bc38fe7b16b3a.tar.bz2 |
re PR fortran/21034 ([4.0 only] internal compiler error: in gfc_trans_auto_array_allocation, at fortran/trans-array.c:3036)
2005-06-22 Paul Brook <paul@codesourcery.com>
PR fortran/21034
* symbol.c (gfc_is_var_automatic): New function.
(save_symbol): Use it.
testsuite/
* gfortran.dg/auto_save_1.f90: New test.
From-SVN: r101250
Diffstat (limited to 'gcc/fortran/symbol.c')
-rw-r--r-- | gcc/fortran/symbol.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 5fb9f53..f91b72d 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -2331,6 +2331,25 @@ gfc_traverse_ns (gfc_namespace * ns, void (*func) (gfc_symbol *)) } +/* Return TRUE if the symbol is an automatic variable. */ +static bool +gfc_is_var_automatic (gfc_symbol * sym) +{ + /* Pointer and allocatable variables are never automatic. */ + if (sym->attr.pointer || sym->attr.allocatable) + return false; + /* Check for arrays with non-constant size. */ + if (sym->attr.dimension && sym->as + && !gfc_is_compile_time_shape (sym->as)) + return true; + /* Check for non-constant length character vairables. */ + if (sym->ts.type == BT_CHARACTER + && sym->ts.cl + && gfc_is_constant_expr (sym->ts.cl->length)) + return true; + return false; +} + /* Given a symbol, mark it as SAVEd if it is allowed. */ static void @@ -2344,7 +2363,9 @@ save_symbol (gfc_symbol * sym) || sym->attr.dummy || sym->attr.flavor != FL_VARIABLE) return; - + /* Automatic objects are not saved. */ + if (gfc_is_var_automatic (sym)) + return; gfc_add_save (&sym->attr, sym->name, &sym->declared_at); } |