------- Comment #2 from burnus at gcc dot gnu dot org 2010-02-26 07:44 ------- Created an attachment (id=19966) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19966&action=view) Improved patch
This patch changes: a) There was a bug, which causes that non-SAVEd variables in procedures where not re-initialized if they were (TREE_)STATIC due to -fmax-stack-var-size=1. I now check also for is_main_program. (wrong-code) b) Initializing the static variables in such cases is pointless if one needs to initialize them explicitly afterwards. (missed optimization - will at least increase the file size.) (Note: I build the patch, I have not regtested it, but I think it is very unlikely that it fails. What I wrote before still holds: The value for the actual argument to the dummy "dealloc" should be checked - esp. in trans-openmp.f90.) Example: Have a look at the dump of. You should not see static struct t1 x = {.a={-43, -43, ... static struct t1 y = {.a={-43, -43, ... but you should see t1.2.a[S.3 + -1] = -43; y.b.data = 0B; t2.0.a[S.1 + -1] = -43; ! { dg-options "-fmax-stack-var-size=1" } module m type t1 integer :: a(200) = -43 end type t1 type t2 integer :: a(200) = -43 integer, allocatable :: b(:) end type t2 contains subroutine sub() type(t1) :: x type(t2) :: y if (x%a(1) /= -43) call abort() if (y%a(1) /= -43) call abort() ! if (any (x%a /= -43)) call abort() ! if (any (y%a /= -43)) call abort() end subroutine sub end module m use m call sub() call sub() end -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #19962|0 |1 is obsolete| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43178