public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/99183] New: Incompatible Runtime types
@ 2021-02-20 20:06 drikosev at gmail dot com
  2021-02-22 10:48 ` [Bug fortran/99183] " drikosev at gmail dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: drikosev at gmail dot com @ 2021-02-20 20:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99183
           Summary: Incompatible Runtime types
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: drikosev at gmail dot com
  Target Milestone: ---

Having post a question in c.l.f I was informed that the program below is
invalid but gfortran accepts it (several versions). This is the question:
https://groups.google.com/g/comp.lang.fortran/c/jWHX3kJMeYY/m/4IMgy19hDgAJ

Hope it isn't a duplicate!

$ gfortran8 dream-casting.f90 && ./a.out
 allocated    x = d1(ind=1,i=1)
 allocated    v = d2(ind=2,j=2)
 assigned v = x,  now v%ind=           1 j=           1
$ cat dream-casting.f90
program test
    implicit none

  type :: d0
    integer :: ind
  end type d0

  type, extends(d0) :: d1
    integer :: i
  end type d1

  type, extends(d0) :: d2
    integer :: j
  end type d2

  class(d1),      allocatable :: x
  class(d2),      allocatable :: v

  allocate ( x ,    source = d1(1,1))
  print *, "allocated    x = d1(ind=1,i=1)"

  allocate ( v ,    source = d2(2,2))
  print *, "allocated    v = d2(ind=2,j=2)"

  v = x
  print *, "assigned v = x,  now v%ind=", v%ind, "j=", v%j

end program test

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

end of thread, other threads:[~2024-04-25 14:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-20 20:06 [Bug fortran/99183] New: Incompatible Runtime types drikosev at gmail dot com
2021-02-22 10:48 ` [Bug fortran/99183] " drikosev at gmail dot com
2021-03-27 16:21 ` dominiq at lps dot ens.fr
2021-10-24 14:27 ` [Bug fortran/99183] [9/10/11 Regression] " dominiq at lps dot ens.fr
2021-10-24 14:41 ` dominiq at lps dot ens.fr
2021-11-16 13:07 ` rguenth at gcc dot gnu.org
2022-05-27  9:44 ` [Bug fortran/99183] [10/11 " rguenth at gcc dot gnu.org
2022-06-28 10:43 ` jakub at gcc dot gnu.org
2023-07-07 10:39 ` [Bug fortran/99183] [11 " rguenth at gcc dot gnu.org
2024-04-25 13:46 ` pault at gcc dot gnu.org
2024-04-25 14:45 ` pault 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).