Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

ICE on invalid specification expression using SIZE

Harald1
New Contributor II
1,213 Views

Hello,

the following invalid code ICEs with current ifort/ifx:

program bug
  implicit none
  print *, f([1.])
contains
  function f(b)
    real, intent(in) :: b(:)
    real, pointer    :: c(:)
!   real             :: f(size(b)) ! <-- This would be valid
    real             :: f(size(c)) ! <-- This is invalid
  end
end

I get:

% ifort ifort-bad-specification.f90
ifort-bad-specification.f90(5): warning #6178: The return value of this FUNCTION has not been defined.   [F]
  function f(b)
-----------^
ifort-bad-specification.f90(9): catastrophic error: **Internal compiler error: internal abort** Please report this error along with the circumstances in which it occurred in a Software Problem Report.  Note: File and line given may not be explicit cause of this error.
compilation aborted for ifort-bad-specification.f90 (code 1)

 and a similar ICE with traceback for ifx.  Replacing "pointer" by "allocatable" gives the same crash, as well as other ranks than 1 except for c being a scalar.

Likely an error recovery issue in the compiler.

 

1 Solution
Barbara_P_Intel
Employee
944 Views

The ICE melted from this reproducer with the 2024.1 compilers that were released last week.

Please give the new ifx and ifort a try.



View solution in original post

0 Kudos
4 Replies
Barbara_P_Intel
Employee
1,179 Views

Thank you for reporting this with a great reproducer and the extra insight!

I filed a bug report, CMPLRLLVM-49873. I'll post when a fix is available.



0 Kudos
Barbara_P_Intel
Employee
1,155 Views

One of the compiler engineers took an initial look at this and points out, "By Fortran rules, local variable C is completely undefined.  That is, the initial state for a pointer is 'undefined'.  Its size would be completely random. So, while it's Not Nice (tm) that we give an ICE at compile time, the program is invalid and likely gives a segfault at runtime."



0 Kudos
Barbara_P_Intel
Employee
945 Views

The ICE melted from this reproducer with the 2024.1 compilers that were released last week.

Please give the new ifx and ifort a try.



0 Kudos
Harald1
New Contributor II
906 Views

Thanks for fixing this!

 

0 Kudos
Reply