public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47240] New: segfault with procedure pointer component
@ 2011-01-10  9:10 m.a.hulsen at tue dot nl
  2011-01-10  9:37 ` [Bug fortran/47240] " burnus at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: m.a.hulsen at tue dot nl @ 2011-01-10  9:10 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-01-19  8:34 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-10  9:10 [Bug fortran/47240] New: segfault with procedure pointer component m.a.hulsen at tue dot nl
2011-01-10  9:37 ` [Bug fortran/47240] " burnus at gcc dot gnu.org
2011-01-10 10:54 ` [Bug fortran/47240] [F03] " janus at gcc dot gnu.org
2011-01-10 20:34 ` janus at gcc dot gnu.org
2011-01-10 21:55 ` janus at gcc dot gnu.org
2011-01-11 11:55 ` janus at gcc dot gnu.org
2011-01-11 14:23 ` dominiq at lps dot ens.fr
2011-01-11 14:55 ` janus at gcc dot gnu.org
2011-01-11 23:15 ` dominiq at lps dot ens.fr
2011-01-12 21:00 ` janus at gcc dot gnu.org
2011-01-12 21:21 ` dominiq at lps dot ens.fr
2011-01-12 21:54 ` burnus at gcc dot gnu.org
2011-01-12 22:40 ` dominiq at lps dot ens.fr
2011-01-13  6:25 ` jvdelisle at gcc dot gnu.org
2011-01-13 18:58 ` dominiq at lps dot ens.fr
2011-01-18 23:21 ` janus at gcc dot gnu.org
2011-01-18 23:21 ` janus at gcc dot gnu.org
2011-01-19  8:57 ` m.a.hulsen at tue dot nl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).