This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
DEALLOCATE is full of bugs :(
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: fortran at gcc dot gnu dot org
- Date: Fri, 5 Dec 2008 15:28:32 -0800
- Subject: DEALLOCATE is full of bugs :(
Well, adding ERRMSG to deallocate has opened up a minefield
of bugs. These won't be fixed until 4.5.
program z
integer, allocatable :: i(:)
integer :: j(3) = 42
allocate(i(4))
deallocate(i, stat=j)
print '(3(I0,1X))', j
end program z
troutmask:sgk[317] gfc4x -o z c.f90
c.f90: In function 'z':
c.f90:4: internal compiler error: Segmentation fault: 11
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
The stat-variable is not checked if it is a scalar. I'll
have this fixed sometime today maybe.
program z
integer, allocatable :: i(:)
integer :: j(3) = 42
allocate(i(4))
deallocate(i, stat=i(1))
end program z
The stat-variable cannot be deallocated in the same statment.
This one I have fixed.
program z
integer, allocatable :: i(:)
integer :: j(3) = 42
allocate(i(4))
deallocate(i, i)
end program z
This should be caught at compile time. Tobias opened a PR about
it, and I have this one fixed. Otherwise, we get a runtime error
on the second deallocation of i.
--
Steve