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

check arguments of called subroutines

SCHWOERTZIG_T_
Beginner
417 Views

Hi all,

I am wondering if there is a compiler option which enables to check arguments of call subroutines/functions while compiling (argument numbers or event types). Or maybe a run time tool activated with a flag ? My main purpose is to check if no argument is missing in source lines while calling a subroutine or a function.

Thanks & Best Regards.
Thierry

0 Kudos
4 Replies
Steven_L_Intel1
Employee
417 Views

There is: -warn interfaces

0 Kudos
SCHWOERTZIG_T_
Beginner
417 Views

Thank you very much for the quick reply.

I tested and compiler is aborting due to an argument type which differs.
Is there a way to skip type checking and only check argument numbers ?

Thanks and Best Regards
Thierry

0 Kudos
jimdempseyatthecove
Honored Contributor III
417 Views

Argument type mismatch is just as bad and number of argument mismatches. You really should correct both types of errors.

This said, some older routines may have you passing a scalar (e.g. reference to 1st element of an array), and where the code then subsequently references the dummy scalar with a subscript. You should take the time to clean this up. You may find some hidden errors in your code. It is not unusual to find yourself asking "How did this ever run?".

Jim Dempsey

0 Kudos
Steven_L_Intel1
Employee
417 Views

You do understand that a mismatched type is still an error, yes? And can lead to wrong results if not careful?

You could add, in the routine being called:

!DIR$ ATTRIBUTES NO_ARG_CHECK :: name-of-dummy-argument

This will disable type and shape checking for that one argument.

Better is to correct the program to not have such mismatches.

0 Kudos
Reply