- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm having problems with the following program
program test_allocatable use inheritance_stuff, only : base, extender implicit none class(base), allocatable :: obj(:) integer :: i, n n = 6 allocate(extender :: obj(n)) do i = 1,n allocate(obj(i)%array(1)) write(*,*) allocated(obj(i)%array) end do end program test_allocatable
with the module
module inheritance_stuff implicit none type base double precision, allocatable :: array(:) end type base type, extends(base) :: extender double precision :: whatever end type extender end module inheritance_stuff
When compiled with ifort 18.0.0 20170811 on CentOS Linux 7.4.1708 the resulting program gives the following output
T F F F F T
The derived type seems to 'forget' the allocation status of it's components, and if I were to subsequently use one these components it would lead to a segmentation fault.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I can conform that behavior for PSXE 2017 u6, PSXE2018 u3 and PSXE2019beta u1 (on win 10, if it matters). Whether this is a bug I cannot say. I've observed, if you change line 4 in the program part from 'class' to 'type' and allocate 'obj' as 'base' the answer is for all components 'T'.
Old gcc 5.4.0 20160609 compiles and runs the original example without errors and produces for all components 'T'. That means not that gfortran or the code is standard conforming, but it smells like a bug in ifort.
I would file it to OSC (https://supporttickets.intel.com/?lang=en-US).
Johannes

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page