Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29386 Discussions

Compiler does not catch type bound function argument's intent mismatch

abhimodak
New Contributor I
844 Views
In the snippet below, I believe the compiler is missing to catch intent(INOUT) vs Intent(IN) in subroutine Inspect.

Note that if the commented calls are used then there is a compile-time error. Thus, only if I am using type bound function syntax then the error goes undetected.

Abhi

==================


[fortran]Module OM
   
   Implicit None
   
   Type newCar
      Integer :: n
   Contains
      Procedure :: Check
      Procedure :: Inspect
      Procedure :: Test
   End Type newCar

Contains
   
   Subroutine Inspect(Car)
      Class(newCar), Intent(IN) :: Car
      Integer :: m
      !Call Check(Car)
      !Call Car%Check
      !m = Test(Car)
      m = Car%Test()
   End Subroutine Inspect
   
   Subroutine Check(Car)
      Class(newCar), Intent(INOUT) :: Car
   End Subroutine Check
   
   Function Test(Car) Result(i)
      Integer :: i
      Class(newCar), Intent(INOUT) :: Car
      i = 0
   End Function Test
   
End Module OM[/fortran]
0 Kudos
2 Replies
Steven_L_Intel1
Employee
844 Views
Abhi,

Thanks for bringing this to our attention. I have escalated it to the developers and will let you know when it is fixed.
0 Kudos
Steven_L_Intel1
Employee
844 Views
This issue will be fixed in Update 3 to Intel Visual Fortran Composer 2011.
0 Kudos
Reply