- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Consider the following minimal example:
module m
type t
private
integer,allocatable::a(:),b ! works without `b`
end type
contains
subroutine f(o)
type(t)o
if(allocated(o%a))deallocate(o%a)
allocate(o%a(1)) ! `ifx` produces executable that considers this array as allocated here
end
end
program p
type u
procedure(i),nopass,pointer::f
integer,allocatable::e
end type
interface
subroutine i()
end
end interface
type(u)q
q=n(s) ! works without this unnecessary line
call s()
contains
subroutine s()
use m
class(t),allocatable::o ! works with `type` instead of `class`
o=t()
call f(o)
end
type(u)function n(f)
procedure(i)f
n%f=>f
end
end
The code was compiled with ifx 2025.0.0 and enabled OpenMP (`-fopenmp` or `-fiopenmp`). Running the executable will produce a runtime error `forrtl: severe (151): allocatable array is already allocated`, because the executable thinks that `o%a` is allocated at line 10, even though `allocated(o%a)` was `.false.` at the previous line. It's the same error as in this post but now without pFUnit.
Strangely, this issue can be fixed by disabling OpenMP, removing `b` from `t`, removing unnecessary `q=n(s)`, or replacing `class` with `type`.
Link Copied
0 Replies
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page