- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When I try to compile the following submodule, I get the following remark from ifort that the result variable has not been used:
..\src\mod_Calculus@Gradient.f90(12): remark #7712: This variable has not been used. [GRADCOMPLEXSTEP] module function GetGradComplexStep(GetCplxFunc,nd,Delta,Point) result(GradComplexStep) ------------------------------------------------------------------------^
clearly, this is a wrong remark as the result variable is indeed used in the body of the code. Why does the compiler issue such a remark?
submodule (Calculus) Gradient use Constants, only: IK, RK implicit none contains ! Compute the first derivative using the complex-step method. module function GetGradComplexStep(GetCplxFunc,nd,Delta,Point) result(GradComplexStep) use Constants, only: IK, RK implicit none procedure(GetCplxFuncProc) :: GetCplxFunc integer(IK), intent(in) :: nd real(RK) , intent(in) :: Delta(nd) real(RK) , intent(in) :: Point(nd) real(RK) :: GradComplexStep(nd) complex(RK) :: PointComplex(nd) integer(IK) :: i PointComplex = Point do i = 1, nd PointComplex(i) = cmplx( Point(i) , Delta(i) , kind=RK ) GradComplexStep(i) = aimag( GetCplxFunc( nd , PointComplex ) ) / Delta(i) PointComplex(i) = cmplx( Point(i) , 0._RK , kind=RK ) end do end function GetGradComplexStep end submodule Gradient
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which version of the compiler are you using? It will be easier for people to help if you can supply a complete compilable source - right now the modules Constants and Calculus are missing. (I tried it with Intel Fortran 2017, adding dummy modules and did not get that warning).
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page