public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/97037] New: ICE on user-defined derived-type output of an intermediate ancestor type
@ 2020-09-13  1:47 damian at sourceryinstitute dot org
  2020-09-13 20:04 ` [Bug fortran/97037] " jvdelisle at charter dot net
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: damian at sourceryinstitute dot org @ 2020-09-13  1:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97037
           Summary: ICE on user-defined derived-type output of an
                    intermediate ancestor type
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: damian at sourceryinstitute dot org
  Target Milestone: ---

The code below effectively has an abstract parent type ("object"), abstract
child type ("oracle"), and a non-abstract grandchild type ("results_t") in
which the parent has a derived-type output binding, the child has a type-bound
operator(-) associated with a deferred binding ("negative"), and the grandchild
implements both deferred bindings.  An ICE results when attempting to write the
result of the operator.  Presumably the issue is that the grandchild's operator
result must be of the child type.  The child type inherits the derived-type
output binding from the parent, but it doesn't itself explicitly state such a
binding. I lean toward thinking the code is valid, but I haven't yet consulted
the standard.

$ cat uddtio-ice.f90 
module object_interface
  implicit none

  type, abstract :: object
  contains
    procedure(write_formatted_interface), deferred :: write_formatted
    generic :: write(formatted) => write_formatted
  end type

  abstract interface
    subroutine write_formatted_interface(this, unit, iotype, vlist, iostat,
iomsg)
      import object
      implicit none
      class(object), intent(in) :: this
      integer, intent(in) :: unit, vlist(:)
      character(len=*), intent(in) :: iotype
      integer, intent(out) :: iostat
      character(len=*), intent(inout) :: iomsg
    end subroutine
  end interface

  type, abstract, extends(object) :: oracle
  contains
    procedure(negative_interface), deferred :: negative
    generic :: operator(-) => negative
  end type

  abstract interface
    function negative_interface(this)
      import oracle
      implicit none
      class(oracle), intent(in) :: this
      class(oracle), allocatable :: negative_interface
    end function
  end interface

  type, extends(oracle) :: results_t
  contains
    procedure write_formatted
    procedure negative
  end type

  interface
    module subroutine write_formatted(this, unit, iotype, vlist, iostat, iomsg)
      implicit none
      class(results_t), intent(in) :: this
      integer, intent(in) :: unit, vlist(:)
      character(len=*), intent(in) :: iotype
      integer, intent(out) :: iostat
      character(len=*), intent(inout) :: iomsg
    end subroutine
    module function negative(this)
      implicit none
      class(results_t), intent(in) :: this
      class(oracle), allocatable :: negative
    end function
  end interface
end module

  use object_interface
  write(*,*) -results_t()
end program

$ gfortran -c uddtio-ice.f90 
uddtio-ice.f90:61:0:

   61 |   write(*,*) -results_t()
      | 
internal compiler error: Segmentation fault: 11

$ gfortran --version
GNU Fortran (GCC) 11.0.0 20200804 (experimental)

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

* [Bug fortran/97037] ICE on user-defined derived-type output of an intermediate ancestor type
  2020-09-13  1:47 [Bug fortran/97037] New: ICE on user-defined derived-type output of an intermediate ancestor type damian at sourceryinstitute dot org
@ 2020-09-13 20:04 ` jvdelisle at charter dot net
  2020-09-13 20:06 ` jvdelisle at charter dot net
  2020-10-05 22:34 ` dominiq at lps dot ens.fr
  2 siblings, 0 replies; 4+ messages in thread
From: jvdelisle at charter dot net @ 2020-09-13 20:04 UTC (permalink / raw)
  To: gcc-bugs

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

Jerry DeLisle <jvdelisle at charter dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jvdelisle at charter dot net

--- Comment #1 from Jerry DeLisle <jvdelisle at charter dot net> ---
This may be related to or the same as 89219

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

* [Bug fortran/97037] ICE on user-defined derived-type output of an intermediate ancestor type
  2020-09-13  1:47 [Bug fortran/97037] New: ICE on user-defined derived-type output of an intermediate ancestor type damian at sourceryinstitute dot org
  2020-09-13 20:04 ` [Bug fortran/97037] " jvdelisle at charter dot net
@ 2020-09-13 20:06 ` jvdelisle at charter dot net
  2020-10-05 22:34 ` dominiq at lps dot ens.fr
  2 siblings, 0 replies; 4+ messages in thread
From: jvdelisle at charter dot net @ 2020-09-13 20:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jerry DeLisle <jvdelisle at charter dot net> ---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89219

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

* [Bug fortran/97037] ICE on user-defined derived-type output of an intermediate ancestor type
  2020-09-13  1:47 [Bug fortran/97037] New: ICE on user-defined derived-type output of an intermediate ancestor type damian at sourceryinstitute dot org
  2020-09-13 20:04 ` [Bug fortran/97037] " jvdelisle at charter dot net
  2020-09-13 20:06 ` jvdelisle at charter dot net
@ 2020-10-05 22:34 ` dominiq at lps dot ens.fr
  2 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-10-05 22:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> This may be related to or the same as pr89219

At least they ICE the same way.

*** This bug has been marked as a duplicate of bug 89219 ***

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

end of thread, other threads:[~2020-10-05 22:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-13  1:47 [Bug fortran/97037] New: ICE on user-defined derived-type output of an intermediate ancestor type damian at sourceryinstitute dot org
2020-09-13 20:04 ` [Bug fortran/97037] " jvdelisle at charter dot net
2020-09-13 20:06 ` jvdelisle at charter dot net
2020-10-05 22:34 ` 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).