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: unassig...@gcc.gnu.org ReportedBy: t...@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.