http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55867
Bug #: 55867 Summary: Segmentation fault on DEALLOCATION of type with ALLOCATABLE components Classification: Unclassified Product: gcc Version: 4.6.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: gilbert.sc...@easynet.co.uk $ uname -a Linux localhost.localdomain 3.1.0-7.fc16.i686.PAE #1 SMP Tue Nov 1 20:53:45 UTC 2011 i686 i686 i386 GNU/Linux $ gfortran --version GNU Fortran (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1) $ cat testprog.f95 MODULE M IMPLICIT NONE TYPE T1 REAL (KIND=8), ALLOCATABLE :: A(:) REAL (KIND=8), ALLOCATABLE :: B(:) END TYPE T1 TYPE T2 TYPE(T1), ALLOCATABLE :: S1 END TYPE T2 TYPE T3 TYPE(T2), ALLOCATABLE :: S2(:) END TYPE T3 END MODULE M PROGRAM TEST USE M IMPLICIT NONE TYPE(T3) :: S3 WRITE (0,*) '## 1 ##' ALLOCATE ( S3%S2(10) ) WRITE (0,*) '## 2 ##' DEALLOCATE ( S3%S2 ) WRITE (0,*) '## 3 ##' END PROGRAM TEST $ gfortran -Wall testprog.f95 -o testprog $ ./testprog ## 1 ## ## 2 ## Segmentation fault (core dumped) ?? The WRITE statements show that the SIGSEGV occurs on the DEALLOCATE statement. Why? It seems to be something to do with the heirarchy of types with allocatable components. If this is made simpler, then the problem goes away !?!