public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/100813] New: Function of array of pointers to abstract class returning an array
@ 2021-05-28 13:34 mailling-lists-bd at posteo dot de
  2021-05-31  8:38 ` [Bug fortran/100813] Function of array of pointers to abstract class returning an array since r6-202-gf3b0bb7a560be0f0 marxin at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: mailling-lists-bd at posteo dot de @ 2021-05-28 13:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100813

            Bug ID: 100813
           Summary: Function of array of pointers to abstract class
                    returning an array
           Product: gcc
           Version: 10.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mailling-lists-bd at posteo dot de
  Target Milestone: ---

Hello, 

I was trying to write a function that takes an array of pointers to an abstract
class as argument, and that returns an array with a shape determined by a
member of the mentioned abstract class.  The following example segfaults with
gfortran 10.3 on Opensuse: 

module baseClass
  implicit none

  type, abstract, public :: base
     integer, allocatable :: i(:)
   contains
     procedure(sub), deferred, pass :: mysub
  end type base

  abstract interface
     subroutine sub(bb) 
       import :: base
       class(base), intent(in) :: bb
     end subroutine sub
  end interface

  type, public :: baseWrap
     class(base), pointer :: p
  end type baseWrap

  public :: operate_on_baseWrap

contains

  function operate_on_baseWrap(wrapped) result(res)
    class(baseWrap), intent(in) :: wrapped(:)

    integer :: i, tmp
    integer, dimension(size(wrapped(1)%p%i)) :: res

    do i=1, size(wrapped)
       call wrapped(i)%p%mysub
    end do

    res = 0
  end function operate_on_baseWrap

end module baseClass


module childClass
  use baseClass
  implicit none

  type, extends(base), public :: child1
   contains
     procedure, pass :: mysub => sub_child1
  end type child1

contains

  subroutine sub_child1(bb)
    class(child1), intent(in) :: bb

    print *, 'Do something', bb%i
  end subroutine sub_child1

end module childClass


program test
  use baseClass
  use childClass
  implicit none

  type(baseWrap), allocatable :: wrapper(:)

  type(child1), allocatable, target :: c(:)

  integer :: i

  integer, allocatable :: tmp(:)

  allocate(wrapper(3))
  allocate(c(3))

  do i=1, 3
     allocate(c(i)%i(3))
     c(i)%i = i
     wrapper(i)%p => c(i)
  end do

  allocate(tmp(size(wrapper(1)%p%i)))
  tmp = operate_on_baseWrap(wrapper)
end program test

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

* [Bug fortran/100813] Function of array of pointers to abstract class returning an array since r6-202-gf3b0bb7a560be0f0
  2021-05-28 13:34 [Bug fortran/100813] New: Function of array of pointers to abstract class returning an array mailling-lists-bd at posteo dot de
@ 2021-05-31  8:38 ` marxin at gcc dot gnu.org
  2021-05-31 10:53 ` dominiq at lps dot ens.fr
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-05-31  8:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100813

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |vehre at gcc dot gnu.org
            Summary|Function of array of        |Function of array of
                   |pointers to abstract class  |pointers to abstract class
                   |returning an array          |returning an array since
                   |                            |r6-202-gf3b0bb7a560be0f0

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r6-202-gf3b0bb7a560be0f0.

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

* [Bug fortran/100813] Function of array of pointers to abstract class returning an array since r6-202-gf3b0bb7a560be0f0
  2021-05-28 13:34 [Bug fortran/100813] New: Function of array of pointers to abstract class returning an array mailling-lists-bd at posteo dot de
  2021-05-31  8:38 ` [Bug fortran/100813] Function of array of pointers to abstract class returning an array since r6-202-gf3b0bb7a560be0f0 marxin at gcc dot gnu.org
@ 2021-05-31 10:53 ` dominiq at lps dot ens.fr
  2022-04-21 18:25 ` mikael at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2021-05-31 10:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100813

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-05-31
             Status|UNCONFIRMED                 |NEW

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

* [Bug fortran/100813] Function of array of pointers to abstract class returning an array since r6-202-gf3b0bb7a560be0f0
  2021-05-28 13:34 [Bug fortran/100813] New: Function of array of pointers to abstract class returning an array mailling-lists-bd at posteo dot de
  2021-05-31  8:38 ` [Bug fortran/100813] Function of array of pointers to abstract class returning an array since r6-202-gf3b0bb7a560be0f0 marxin at gcc dot gnu.org
  2021-05-31 10:53 ` dominiq at lps dot ens.fr
@ 2022-04-21 18:25 ` mikael at gcc dot gnu.org
  2022-04-22 12:31 ` marxin at gcc dot gnu.org
  2024-06-12  7:23 ` vehre at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mikael at gcc dot gnu.org @ 2022-04-21 18:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100813

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #2 from Mikael Morin <mikael at gcc dot gnu.org> ---
It seems to work with a recent master (12.0.1 20220410).

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

* [Bug fortran/100813] Function of array of pointers to abstract class returning an array since r6-202-gf3b0bb7a560be0f0
  2021-05-28 13:34 [Bug fortran/100813] New: Function of array of pointers to abstract class returning an array mailling-lists-bd at posteo dot de
                   ` (2 preceding siblings ...)
  2022-04-21 18:25 ` mikael at gcc dot gnu.org
@ 2022-04-22 12:31 ` marxin at gcc dot gnu.org
  2024-06-12  7:23 ` vehre at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-04-22 12:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100813

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |12.0
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Yes, it was fixed with r12-7526-gc0134b7383992aab.
@Tobias: Is it a dup of any of the PRs referenced in the commit (PR99585,
PR104430)?

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

* [Bug fortran/100813] Function of array of pointers to abstract class returning an array since r6-202-gf3b0bb7a560be0f0
  2021-05-28 13:34 [Bug fortran/100813] New: Function of array of pointers to abstract class returning an array mailling-lists-bd at posteo dot de
                   ` (3 preceding siblings ...)
  2022-04-22 12:31 ` marxin at gcc dot gnu.org
@ 2024-06-12  7:23 ` vehre at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vehre at gcc dot gnu.org @ 2024-06-12  7:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100813

Andre Vehreschild <vehre at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |vehre at gcc dot gnu.org
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=104430
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Andre Vehreschild <vehre at gcc dot gnu.org> ---
Reported to be working now. Closing.

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

end of thread, other threads:[~2024-06-12  7:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-28 13:34 [Bug fortran/100813] New: Function of array of pointers to abstract class returning an array mailling-lists-bd at posteo dot de
2021-05-31  8:38 ` [Bug fortran/100813] Function of array of pointers to abstract class returning an array since r6-202-gf3b0bb7a560be0f0 marxin at gcc dot gnu.org
2021-05-31 10:53 ` dominiq at lps dot ens.fr
2022-04-21 18:25 ` mikael at gcc dot gnu.org
2022-04-22 12:31 ` marxin at gcc dot gnu.org
2024-06-12  7:23 ` vehre at gcc dot gnu.org

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