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.
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.
連結已複製
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."
