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
This commit is contained in:
Paul Brook 2005-06-22 15:34:02 +00:00 committed by Paul Brook
parent aacb351279
commit bd83e6142d
4 changed files with 51 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2005-06-22 Paul Brook <paul@codesourcery.com>
PR fortran/21034
* symbol.c (gfc_is_var_automatic): New function.
(save_symbol): Use it.
2005-06-21 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
Paul Thomas <pault@gcc.gnu.org>

View file

@ -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);
}

View file

@ -1,3 +1,8 @@
2005-06-22 Paul Brook <paul@codesourcery.com>
PR fortran/21034
* gfortran.dg/auto_save_1.f90: New test.
2005-06-22 Michael Matz <matz@suse.de>
* gcc.target/x86-64/abi: New directory.

View file

@ -0,0 +1,18 @@
! { dg-do run }
! Check that automatic objects work properly in the presence of a save
! statement.
! PR21034
subroutine test(n)
implicit none
integer n
real dte(n)
character(len=n) :: s
save
dte = 0
s = ""
end
program prog
call test(4)
call test(10)
end program