From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2255 invoked by alias); 10 Jan 2011 08:47:22 -0000 Received: (qmail 2246 invoked by uid 22791); 10 Jan 2011 08:47:21 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 10 Jan 2011 08:47:16 +0000 From: "m.a.hulsen at tue dot nl" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/47240] New: segfault with procedure pointer component X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: m.a.hulsen at tue dot nl X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Mon, 10 Jan 2011 09:10:00 -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 X-SW-Source: 2011-01/txt/msg00870.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47240 Summary: segfault with procedure pointer component Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: m.a.hulsen@tue.nl The following code gives a segmentation fault. module element_defs_m type tfunc_p procedure (dum_tfunc), pointer, nopass :: p => null() end type tfunc_p type coefficients_t type(tfunc_p), allocatable, dimension(:) :: tfunc1 end type coefficients_t contains function dum_tfunc ( n, x ) integer, intent(in) :: n real, intent(in), dimension(:) :: x real, dimension(n,n) :: dum_tfunc dum_tfunc = 0 end function dum_tfunc end module element_defs_m module m1 use element_defs_m contains subroutine scalar_diffusion2_elem ( coefficients) type(coefficients_t), intent(in) :: coefficients real :: coef (2,2) call evaluate_tensor_coefficient ( coefficients%tfunc1(1)%p, coef ) print *, coef end subroutine scalar_diffusion2_elem subroutine evaluate_tensor_coefficient ( tfunc, coef ) interface function tfunc ( n, x ) integer, intent(in) :: n real, intent(in), dimension(:) :: x real, dimension(n,n) :: tfunc end function tfunc end interface real, dimension(:,:), intent(out) :: coef real :: x(2)=0 coef = tfunc( n=2, x=x ) end subroutine evaluate_tensor_coefficient end module m1 program t use m1 type(coefficients_t) :: coefficients allocate(coefficients%tfunc1(1)) coefficients%tfunc1(1)%p => dum_tfunc call scalar_diffusion2_elem ( coefficients ) end program t