- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everybody!
I am a new user in writing code FORTRAN and I just want to compile a preexisting code which has been compiled and used previously, but with the new version, it seems to have some problems. The issue is I have a subroutine like:
SUBROUTINE UMAT(props, nprops)
dimensionprops(nprops)
But at this line
CALL ROTATION (PROPS(57), ROTATE)
the compiler gives me an error regarding data type conversion problem or something like that, which is "Error: The type of the actual argument differs from the type of the dummy argument"
I have read an article regarding the issue in
http://www.ncsa.illinois.edu/UserInfo/Resources/Software/Intel/Compilers/9.0/F_ReleaseNotes.htm
but as I told, since I am new to FORTRAN, the solution is not clear to me yet.I have a good background in C++ and JAVA, though. So please help me solve the issue.
Thank you,
Hamid,
P.S. I am using intel Fortran v10, x64
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You did not say anything about declaration of subroutine ROTATION. It is hard to help where can be problem.
I think problem is that you do not declare data types of variables so implicit data types are used.
Jakub
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To amplify a little for someone who is "new to FORTRAN", the data types of the actual arguments (in the subroutine call) must be the same as the dummy arguments (in the subroutine itself). In particular, we see that "nprops" is used to dimension the array "props", which means it ought to be an integer. The variable "ROTATE", then, must also be an integer. If, however, you do not explictly declare the variable types, and instead rely on FORTRAN implicit variable types, then "ROTATE" will be a real (floating point) and "nprops" will be an integer. That would produce the compiler error you're getting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Hamid,
a little bit more code would be helpful.
As stated before, you have to make sure that the two data types of the arguments (as declared in SUBROUTINE ROTATION) has to be the same as Props and Rotate.
Example:
[bash]subroutine foo(Number) real(kind=4) Number ... end subroutine[/bash]
Later on you call foo:
[bash]integer(kind=4)::intNumber=5 call foo(intNumber)[/bash]
But that would cause your error. foo wants a real and gets an integer. A solution for that would be
[bash]call foo(real(intNumber))[/bash]
or your declare Number as integer.
Markus

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page