Software Archive
Read-only legacy content
17060 Discussions

Using optional arguments

intelgg
Beginner
1,735 Views
I am getting compiler warning
"Routine PARSETAG called with different number and/or type of
actual arguments in earlier call - C attribute required if intended"
on a situation like the following:

integer function f(a, b, c, d) result(u)
integer a
integer b
integer c
integer, optional :: d
u = 0
end function f

integer function g() result(v)
integer, external :: f
v = f(1,2,3)
end function g

integer function h() result(w)
integer, external :: f
w = f(1,2,3,4)
end function h

The issue seems to be in the proper usage of optional arguments.
How do I resolve this?
0 Kudos
2 Replies
Steven_L_Intel1
Employee
1,735 Views
If a routine has OPTIONAL arguments, an explicit interface must be visible to the caller.

Steve
0 Kudos
james1
Beginner
1,735 Views
Add a trailing comma on the call in g() so that your number of placeholders is consistent.

James
0 Kudos
Reply