public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/56218] New: Segfault with allocatable intent(out) derived type argument having allocatable component
@ 2013-02-06  5:08 townsend at astro dot wisc.edu
  2013-02-06  9:27 ` [Bug fortran/56218] [OOP] " janus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: townsend at astro dot wisc.edu @ 2013-02-06  5:08 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56218

             Bug #: 56218
           Summary: Segfault with allocatable intent(out) derived type
                    argument having allocatable component
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: townsend@astro.wisc.edu


When using a subroutine with an allocatable intent(out) argument which is a
derived type, and this derived type itself contains an allocatable argument, a
segfault occurs on subroutine entry. The segfault disappears if the argument is
declared intent(inout).

Example code (compiled with gfortran 4.8.0 20121215 on OS X 10.7.5):

--
program test_poly

  implicit none

  type :: foo_t
     real, allocatable :: a(:)
  end type foo_t

  class(foo_t), allocatable :: f

  call do_stuff(f)

contains

  subroutine do_stuff (f)

    class(foo_t), intent(out), allocatable :: f

    allocate(f)

    allocate(f%a(3))

    f%a = [1.,2.,3.]

  end subroutine do_stuff

end program test_poly
--

Output from gdb:

--
(gdb) run
Starting program: /Users/townsend/test_poly 
Reading symbols for shared libraries ++++........................ done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x00000001000015dd in do_stuff (f=Invalid F77 type code 3 in symbol table.
) at test_poly.f90:15
15      subroutine do_stuff (f)
(gdb) 
--


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

end of thread, other threads:[~2014-07-15 19:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-06  5:08 [Bug fortran/56218] New: Segfault with allocatable intent(out) derived type argument having allocatable component townsend at astro dot wisc.edu
2013-02-06  9:27 ` [Bug fortran/56218] [OOP] " janus at gcc dot gnu.org
2013-02-06 10:09 ` janus at gcc dot gnu.org
2013-02-06 10:17 ` janus at gcc dot gnu.org
2014-07-15 19:40 ` dominiq at lps dot ens.fr

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).