This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/51310] New: -finit-bla doesn't initialize *all* items of type bla to the requested constant.
- From: "toon at moene dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 26 Nov 2011 09:59:47 +0000
- Subject: [Bug fortran/51310] New: -finit-bla doesn't initialize *all* items of type bla to the requested constant.
- Auto-submitted: auto-generated
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.