public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/51310] New: -finit-bla doesn't initialize *all* items of type bla to the requested constant.
@ 2011-11-26 12:33 toon at moene dot org
  2011-11-29 20:34 ` [Bug fortran/51310] " toon at moene dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: toon at moene dot org @ 2011-11-26 12:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51310

             Bug #: 51310
           Summary: -finit-bla doesn't initialize *all* items of type bla
                    to the requested constant.
    Classification: Unclassified
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: toon@moene.org


The following source:

program nan
implicit none
real(8) :: joo(3)
joo(2) = 0
print *,joo
call sub(3)
end program nan
subroutine sub(n)
implicit none
integer, intent(in) :: n
real(8) :: a(n), var, b(3)
real(8), allocatable :: c(:)
!a(1) = 1
print *,'n=',n
print *,'a=',a
print *,'var=',var
print *,'b=',b
allocate(c(size(b)))
print *,'c=',c
a(1) = a(1) + 1
end subroutine sub

when compiled with gfortran -g -finit-real=snan outputs:

                       NaN   0.0000000000000000                            NaN
 n=           3
 a=   0.0000000000000000        0.0000000000000000        0.0000000000000000    
 var=                       NaN
 b=                       NaN                       NaN                      
NaN
 c=   0.0000000000000000        0.0000000000000000        0.0000000000000000    

Clearly, the allocatable c and the automatic array a are not initialized by the
compiler option.

1. Consider this an enhancement request - a colleague of mine was severely
   hampered in his search for a bug.

2. Consider this a bug report with respect to our documentation, which doesn't
   mention this exceptions at all.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-12-22 19:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-26 12:33 [Bug fortran/51310] New: -finit-bla doesn't initialize *all* items of type bla to the requested constant toon at moene dot org
2011-11-29 20:34 ` [Bug fortran/51310] " toon at moene dot org
2011-12-05 18:17 ` toon at moene dot org
2011-12-05 20:04 ` toon at moene dot org
2011-12-08 18:40 ` toon at gcc dot gnu.org
2011-12-08 21:01 ` toon at gcc dot gnu.org
2011-12-08 21:02 ` toon at moene dot org
2011-12-15 18:35 ` toon at gcc dot gnu.org
2011-12-22 20:18 ` toon at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).