Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
공지
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.
29281 토론

Bug in `ifort` and `ifx` from oneAPI 2021.2.0 & 2022.0.1: false positive of unused variable

Zaikun
새로운 기여자 I
2,086 조회수

This seems to be a bug in Intel oneAPI 2021.2.0 & 2022.0.1. See Fortran Discourse for discussions. Thank you for fixing it. 

 

For the following piece of code, on Ubuntu 20.04 (linux 5.4.0-91-generic), both `ifort` and `ifx` from Intel oneAPI 2021.2.0 or 2022.0.1 give me a warning as follows.

 

 

$ ifort -warn all test_intel.f90
test_intel.f90(16): remark #7712: This variable has not been used. [X]
function foo(fun, n) result(x)
----------------------------^
$ ifx -warn all test_intel.f90
test_intel.f90(16): remark #7712: This variable has not been used. [X]
function foo(fun, n) result(x)
----------------------------^

 

 

Code:

 

 

! test_intel.f90
module test_intel_mod
implicit none
private
public :: foo, bar, fun

abstract interface
function FCN(x) result(f)
implicit none
real, intent(in) :: x
real :: f
end function FCN
end interface

contains

function foo(fun, n) result(x)
implicit none
procedure(FCN) :: fun
integer, intent(in) :: n
real :: x
real :: fval(n)
fval = 0.0
x = fun(0.0) + sum(fval) + real(n)
end function foo

function bar(fun, n) result(x)
implicit none
procedure(FCN) :: fun
integer, intent(in) :: n
real :: x
x = fun(0.0) + real(n)
end function bar

function fun(x) result(f)
implicit none
real, intent(in) :: x
real :: f
f = x
end function fun

end module test_intel_mod

program test_circle
use, non_intrinsic :: test_intel_mod, only : foo, fun
implicit none
real :: x
x = foo(fun, 1)
print *, x
end program test_circle

 

 

 

0 포인트
4 응답
Zaikun
새로운 기여자 I
2,041 조회수

Hello @Barbara_P_Intel ! Sorry to bother you, but this is probably a bug of Intel oneAPI. Thanks.

0 포인트
Barbara_P_Intel
2,014 조회수

Thanks for the nice reproducer. I filed a bug report, CMPLRIL0-34529, on your behalf. I'll let you know when there's a fix.



Zaikun
새로운 기여자 I
1,993 조회수

Thank you very much! I look forward to any updates. 

0 포인트
Barbara_P_Intel
1,660 조회수

The error you reported in fixed in ifort 2021.8.0 and ifx 2023.0.0 that were released in December as part of the oneAPI HPC Toolkit 2023.0. Please check it out!

 

 

0 포인트
응답