Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

Error in running ALLOCATABLE MATRIX in FORTRAN

Ashkan_K_
Beginner
926 Views

Hi everyone,

I'm new in Fortran and using Visual Fortran Composer XE 2013 on Windows 7.

In side of main program I'm calling a subroutine by using: CALL CCOEFF(DL, DD, DDD) and I'm getting these errors:

Error    1     error #7976: An allocatable dummy argument may only be argument associated with an allocatable actual argument.   [DDD] 

Error    2     error #8055: The procedure has a dummy argument that has the ALLOCATABLE, ASYNCHRONOUS, OPTIONAL, POINTER, TARGET, VALUE or VOLATILE attribute. Required explicit interface is missing from original source.   [DDD]

By changing DDD in main program to an Allocatable argument (which related to error 1) I'm getting just the error 2 which I have no idea about it.

It would be very kind of you to help me figure it out.

Thanks in advance and Best Regards,

 

0 Kudos
3 Replies
mecej4
Honored Contributor III
926 Views

Does your subroutine CCOEFF require the third argument to be allocatable? If you do not allocate or deallocate the variable in the subroutine (or in other subroutines called from CCOEFF), there is no need to declare the dummy argument as allocatable. 

If you determine that the argument needs to be allocatable, you have to provide an explicit interface. This can be done in a number of ways, and you should read Fortran textbooks or the Intel Fortran language reference for details.

If you feel tempted to change attributes merely to quieten the compiler, resist the temptation, since you will only succeed in promoting compile time errors to run time errors.

0 Kudos
Ashkan_K_
Beginner
926 Views

Hi Mecej4,

I do appreciate your consideration and response. The third argument has to be allocatable.

Would you please give me some hints about explicit interface which you've mentioned in your comment?

Best Regards,

0 Kudos
jimdempseyatthecove
Honored Contributor III
926 Views

Consult the IVF documents

INTERFACE

Although you can place the interface block within the data declaration section of the code that makes the call, you are best advised to place the interface(s) in a module, then USE that module wherever you make the calls.

Jim Dempsey

0 Kudos
Reply