This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/52418] New: (unnecessary) automatic reallocation of lhs causes segfault
- From: "therobbot at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 28 Feb 2012 15:59:47 +0000
- Subject: [Bug fortran/52418] New: (unnecessary) automatic reallocation of lhs causes segfault
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52418
Bug #: 52418
Summary: (unnecessary) automatic reallocation of lhs causes
segfault
Classification: Unclassified
Product: gcc
Version: 4.6.2
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: therobbot@gmail.com
Created attachment 26771
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26771
program to reproduce bug
The following program causes a segfault:
PROGRAM reshape_test
IMPLICIT NONE
REAL, DIMENSION(:,:), ALLOCATABLE :: m2
REAL, DIMENSION(:,:,:), ALLOCATABLE :: m3
ALLOCATE( m2( 6, 1 ), m3( 2, 3, 1 ) )
m2 = -1
m3 = RESHAPE( m2, SHAPE(m3) )
m3 = 2
WRITE(*,*) 'm3(1,1,1) = ', m3(1,1,1)
END PROGRAM reshape_test
If compiled with -fno-realloc-lhs, the code runs as expected. There really
shouldn't be any reallocation here, so this shouldn't make a difference. Either
way it should not cause a segfault.
Side note: I love all of the work on f2003/2008! The OO features make fortran
fun again. Thanks!