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

ICE with new ifx at omp atomic statement within an associate block

martinmath
New Contributor II
1,338 Views

The following small reproducer compiled with "ifx -fopenmp assoc_atomic.f90 -c" gives an ICE.

Using an explicit pointer (of type integer, dimension(:), pointer)  instead of the associate block circumvents the ICE.

Recently released ifort compiles without complains.

Tested with ifx "Version 2024.0.0 Build 20231017" and ifort "Version 2021.11.0 Build 20231010_000000".

module mod

implicit none
public

contains

subroutine update(x, k, m)
   integer, dimension(:,:), intent(inout) :: x
   integer, intent(in) :: k, m

   associate(i => x(:,1))
!$omp atomic
      i(k) = min(i(k), m)
   end associate
end subroutine update

end module mod

 

0 Kudos
1 Solution
Ron_Green
Moderator
1,325 Views

Thanks for reporting this and including details on the compiler used.  All of these reports help us improve the compiler for the entire community.  We appreciate your help.

THis is fixed in our mainline branch which will go into the next update, 2024.1.0.  Here is the proof using a nightly build from the main branch from yesterday

 

cat repro.f90
module mod

implicit none
public

contains

subroutine update(x, k, m)
   integer, dimension(:,:), intent(inout) :: x
   integer, intent(in) :: k, m

   associate(i => x(:,1))
!$omp atomic
      i(k) = min(i(k), m)
   end associate
end subroutine update

end module mod
~/quad/wednesday$ 
~/quad/wednesday$ ifx -c -qopenmp -what -V repro.f90
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version dev.x.0 Mainline Build 20231127
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.

 Intel(R) Fortran 24.0-1426
~/quad/wednesday$ ls
mod.mod  repro.f90  repro.o

  

View solution in original post

0 Kudos
6 Replies
Ron_Green
Moderator
1,326 Views

Thanks for reporting this and including details on the compiler used.  All of these reports help us improve the compiler for the entire community.  We appreciate your help.

THis is fixed in our mainline branch which will go into the next update, 2024.1.0.  Here is the proof using a nightly build from the main branch from yesterday

 

cat repro.f90
module mod

implicit none
public

contains

subroutine update(x, k, m)
   integer, dimension(:,:), intent(inout) :: x
   integer, intent(in) :: k, m

   associate(i => x(:,1))
!$omp atomic
      i(k) = min(i(k), m)
   end associate
end subroutine update

end module mod
~/quad/wednesday$ 
~/quad/wednesday$ ifx -c -qopenmp -what -V repro.f90
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version dev.x.0 Mainline Build 20231127
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.

 Intel(R) Fortran 24.0-1426
~/quad/wednesday$ ls
mod.mod  repro.f90  repro.o

  

0 Kudos
martinmath
New Contributor II
1,284 Views

Thanks for checking, that sounds great. Still cannot run ifx due to some other issues, but it is shaping up.

 

0 Kudos
Barbara_P_Intel
Employee
1,302 Views

@martinmath, when compiling with ifx (or ifort) use -qopenmp. -fopenmp is deprecated and will disappear at some point.

0 Kudos
martinmath
New Contributor II
1,284 Views

Thanks for pointing out. My cmake setup has indeed qopenmp, but somehow I got mixed up with gfortran options on the command line.

0 Kudos
Barbara_P_Intel
Employee
1,244 Views

Please report ifx issues and we will look at them and see what be done.

You do know that you can mix/match ifx and ifort object files, .mod files, and libraries. There is a CAVEAT, that doesn't work if you compile with -ipo. That may help with your use of ifx.

 

0 Kudos
martinmath
New Contributor II
1,161 Views

There seems to be one final showstopper bug, the solver already runs without qopenmp. With qopenmp there is some elusive problem with allocation, but I think I might have reduced it to a small testcase. For the other few remaining problems I have work-arounds (like for this one). Thanks for the hints.

0 Kudos
Reply