- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Compiling (with ifort 13.1.1) and executing the following code
[fortran]
module tt
type :: t
end type t
type :: t1
class(t), pointer :: tp
contains
procedure :: set
procedure :: unset
end type t1
contains
function t_new() result(r)
type(t), pointer :: r
allocate(r)
end function t_new
subroutine set(a, tp)
class(t1) :: a
class(t), target :: tp
a%tp => tp
end subroutine set
subroutine unset(a)
class(t1) :: a
print *, "Dealocating"
deallocate(a%tp)
print *, "Deallocated"
end subroutine unset
end module tt
program test
use tt
type(t1) :: a
call a%set(t_new())
call a%unset()
end program test
[/fortran]
I get
[plain]
Dealocating
forrtl: severe (173): A pointer passed to DEALLOCATE points to an object that cannot be deallocated
Image PC Routine Line Source
pointer 000000000046D7AE Unknown Unknown Unknown
pointer 000000000046C246 Unknown Unknown Unknown
pointer 0000000000424FC2 Unknown Unknown Unknown
pointer 00000000004068BB Unknown Unknown Unknown
pointer 00000000004050E6 Unknown Unknown Unknown
pointer 0000000000402C57 Unknown Unknown Unknown
pointer 0000000000402B3C Unknown Unknown Unknown
libc.so.6 00007FB324690A15 Unknown Unknown Unknown
pointer 0000000000402A39 Unknown Unknown Unknown
[/plain]
but using gfortran yields
[plain]
Dealocating
Deallocated
[/plain]
Is this a bug?
Best,
Paweł Biernat
Link Copied
- « Previous
-
- 1
- 2
- Next »
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Halfway through 2022 and this bug still exists. I just lost a whole day trying to figure it out before I finally found this thread. Can we please get a fix?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just for kicks, try:
deallocate((a%tp)) ! enclose in ()
and/or
class(t), pointer :: tp_temp
...
tp_temp => a%tp
deallocate(tp_temp)
nullify(a%tp)
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This issue appears to have fallen off the radar sometime back. I have re-escalated this issue to our developers. Bug ID is: CMPLRIL0-21046
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This issue is fixed in the current Fortran compilers that were released earlier this week. The compilers are part of oneAPI HPC Toolkit 2023.2.
Please try it.
I just noticed how old this is. It took us a while.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- « Previous
-
- 1
- 2
- Next »