public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/65359] New: [OOP] undefined output with array and inheritance
@ 2015-03-09 10:01 tkoenig at gcc dot gnu.org
2015-03-13 14:14 ` [Bug fortran/65359] " dominiq at lps dot ens.fr
0 siblings, 1 reply; 2+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-03-09 10:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65359
Bug ID: 65359
Summary: [OOP] undefined output with array and inheritance
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: tkoenig at gcc dot gnu.org
Originally from
http://stackoverflow.com/questions/28933061/using-1n-with-inherited-classes-works-weirdly-in-gfortran
:
module try_mod
implicit none
type, public :: Inner_t
integer :: i
real :: r
end type Inner_t
type, public, extends(Inner_t) :: InnerSpec_t
integer :: j
end type InnerSpec_t
type, public :: Outer_t
integer :: nelem
class( Inner_t ), allocatable, dimension(:) :: elem
contains
procedure :: init => initOuter
end type Outer_t
contains
subroutine initOuter(this)
class(Outer_t), intent(inout) :: this
integer :: i, suma, k
this%nelem = 4
allocate( InnerSpec_t :: this%elem(1:this%nelem) )
this%elem(1:2)%i = -100
this%elem(3:4)%i = -200
print*, '1st: ', this%elem(1:this%nelem)%i
print*, '2nd: ', this%elem(1)%i, this%elem(2)%i, this%elem(3)%i,
this%elem(4)%i
this%elem(1)%i = 91
this%elem(2)%i = 92
this%elem(3)%i = 93
this%elem(4)%i = 94
print*,'3rd: ', this%elem(1:4)%i
print*,'4th: ', this%elem(1)%i, this%elem(2)%i, this%elem(3)%i,
this%elem(4)%i
end subroutine initOuter
end module try_mod
program adgo
use try_mod
implicit none
type( Outer_t ) :: outer
call outer%init()
end program
... has some undefined output (also according to valgrind).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-13 14:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-09 10:01 [Bug fortran/65359] New: [OOP] undefined output with array and inheritance tkoenig at gcc dot gnu.org
2015-03-13 14:14 ` [Bug fortran/65359] " 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).