下面是一些示例代碼:爲什麼ifort - 在接口不匹配時拋出所有拋出錯誤?
! Author: Svetlana Tkachenko [email protected]
! License: GPLv3 or later
subroutine myprint(var)
! integer :: var
! print *, 'Hi, my ', var
end subroutine
module testing
type triangle
integer :: point(3)
end type
end module
program main
use testing
type(triangle) :: mytriangle
mytriangle%point(1)=5
call myprint(mytriangle%point(1))
end program
它正常工作與ifort -c file.f90
,但ifort -warn all -c file.f90
導致錯誤:
blah.f90(4): warning #6717: This name has not been given an explicit type. [VAR]
subroutine myprint(var)
-------------------^
blah.f90(4): remark #7712: This variable has not been used. [VAR]
subroutine myprint(var)
-------------------^
blah.f90(19): error #6633: The type of the actual argument differs from the type of the dummy argument. [POINT]
call myprint(mytriangle%point(1))
---------------------------^
compilation aborted for blah.f90 (code 1)
爲什麼-warn all
拋出一個錯誤?該手冊頁特別說明all
不包括錯誤。
我知道我只能修復代碼,但我正在嘗試爲遺留代碼庫設置測試套件,並且希望能夠在開始進行代碼更改之前運行帶有警告的編譯測試。
您可以(應該)在實際支持論壇上詢問供應商,瞭解其具體行爲的原因。 –
我只是假設你知道'var'在子程序中隱含地是'real' ... –