Parameter size mismatch

The type of an actual argument does not match the corresponding formal parameter at a subroutine call.

Specifically, this error occurs when the actual and formal parameter types do not have the same size. This is treated as a warning when the actual argument is bigger than expected. It is an error when the actual argument is smaller than expected, since this can lead to a bounds violation.

This same kind of error can also happen when a FORTRAN dummy argument of type subroutine is invoked. That is, the subroutine that is invoked through a dummy argument might exhibit the same problem as can occur in a direct call. In this case, the problem may or may not happen depending on what subroutine was passed to the dummy argument of subroutine type. There will be an additional observation in such cases that identifies the call site where the subroutine argument was passed in.

ID

Observation

Description

1

Call site

The actual argument that was passed

2

Definition

The definition of the called procedure and shows the declaration of the formal parameter

Example


subroutine IWant6(m)
integer, dimension(6) :: m
print *, m
end

subroutine IGive4(sub)
external sub
integer, dimension(4) :: n
n = 1
call sub(n)
! size of actual argument is less that size of dummy argument
! when sub is IWant6
end

integer, dimension(4) :: n
n = 1
! size of actual argument is less that size of dummy argument
call IWant6(n)
! Call passes subroutine that will not
! be happy when called from IGive4
call IGive4(IWant6)
end
        

Copyright © 2010, Intel Corporation. All rights reserved.