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

ICE with ifx -assume norealloc_lhs -check all

JacekDziedzic
Beginner
680 Views
module mwe

contains

  subroutine fail(a,b)

    implicit none

    integer, intent(out), optional :: a
    integer, intent(out), optional :: b
    
    integer :: args_present

    args_present = sum(merge(1,0,[present(a),present(b)]))

  end subroutine fail

end module mwe

The above trivial module ICEs ifx 2025.1.0 20250317, but only with this command line:

ifx -assume norealloc_lhs -check all mwe.F90

Dropping either of the options makes the compiler behave.

 

 

0 Kudos
3 Replies
Ron_Green
Moderator
621 Views

It's the -check shape along with -assume norealloc_lhs combo.  I can see how the compiler could get confused about how to check shape when you say to not create an temp for the LHS in this case.  Easy for us to see that the result of the expression on the LHS is a simple scalar, but it's a merge of an array which is then sum'med.  
I will get a bug report started.  Until there is a fix you can use

-warn all,noshape

to prevent the error.  

 

Thank you for a simple and easy to understand sample. 

0 Kudos
Ron_Green
Moderator
616 Views

bug ID is CMPLRLLVM-68884


0 Kudos
JacekDziedzic
Beginner
500 Views

Thank you for making this into a bug ID and for the suggested workaround. We found that a simple replacement of

sum(merge(1,0,[...]))

with

count([...])

made the compiler behave.

0 Kudos
Reply