re PR fortran/17678 (USE statement incorrectly initializes allocatable array)

PR fortran/17678
	* trans-array.c (gfc_trans_deferred_array): Leave use associated
	variables alone.
testsuite/
	* gfortran.dg/use_allocated_1.f90: New test.

From-SVN: r88655
This commit is contained in:
Paul Brook 2004-10-07 00:43:21 +00:00 committed by Paul Brook
parent d1d525310b
commit 2b58638b46
4 changed files with 31 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2004-10-07 Paul Brook <paul@codesourcery.com>
PR fortran/17678
* trans-array.c (gfc_trans_deferred_array): Leave use associated
variables alone.
2004-10-06 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/17568

View File

@ -3999,8 +3999,8 @@ gfc_trans_deferred_array (gfc_symbol * sym, tree body)
&& !INTEGER_CST_P (sym->ts.cl->backend_decl))
gfc_trans_init_string_length (sym->ts.cl, &fnblock);
/* Parameter variables don't need anything special. */
if (sym->attr.dummy)
/* Parameter and use associated variables don't need anything special. */
if (sym->attr.dummy || sym->attr.use_assoc)
{
gfc_add_expr_to_block (&fnblock, body);

View File

@ -1,3 +1,8 @@
2004-10-07 Paul Brook <paul@codesourcery.com>
PR fortran/17678
* gfortran.dg/use_allocated_1.f90: New test.
2004-10-06 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/17849

View File

@ -0,0 +1,18 @@
! { dg-do run }
! PR17678
! We were incorrectly setting use-associated variables to unallocated
! on procedure entry.
module foo
integer, dimension(:), allocatable :: bar
end module
program main
use foo
allocate (bar(10))
call init
end program main
subroutine init
use foo
if (.not.allocated(bar)) call abort
end subroutine init