From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 671 invoked by alias); 2 Oct 2015 22:01:47 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 631 invoked by uid 48); 2 Oct 2015 22:01:42 -0000 From: "kargl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/66969] Internal compiler error, segmentation fault Date: Fri, 02 Oct 2015 22:01:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.9.2 X-Bugzilla-Keywords: ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: kargl at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-10/txt/msg00224.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66969 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #2 from kargl at gcc dot gnu.org --- I believe the code is invalid. Here a small rewrite program bug implicit none real, target, allocatable :: a(:,:) allocate(a(10,10)) a = 1.0 print*, f(a) contains function f(b) result(x) real, target, intent(in):: b(:,:) real, pointer :: c(:,:) real :: x(size(c(1,:))) c => b(1:2,:) x = c(2,:) end function f end program bug The line 'real :: x(size(c(1,:))' is referencing an unassociated pointer. If I add the 'integer :: n = size(c(1,:)) I get % gfc6 -c bug.f90 bug.f90:15:29: integer :: n = size(c(1,:)) 1 Error: Deferred array 'c' at (1) is not permitted in an initialization expression A similar error should probably occur here.