Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28895 Discussions

ifx 2025.0.0 produces invalid executable with OpenMP

V-T
New Contributor I
148 Views

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`.

Labels (2)
0 Replies
Reply