- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I apologize if this is not the proper forum for this post.
I encountered a problem iwith an Assembly language (ASM) sorting routine called by Intel Fortran. The ASM routine evidently received its inputs correctly, through its CALL from Fortran, because it did an excellent job of rapidly comb-sorting a very large array. But, instead of returning sampling statistics through its arguments, as I wanted it to, it returned garbage through them.
Now, let's forget the application itself. I have boiled the problem down to a simple set of code. I have eight INTEGER*4 arguments, initially set to values. The ASM code receives the arguments, does nothing (not even a PUSH ESP and POP ESP), and returns. It does not examine the arguments in any way. However, the CALL changes them.
The results are as follows:
Argument 1containsits original value.
Argument 2 contains a long garbage integer.
Argument 3 contains the value that entered through argument 2.
Argument 4 contains 0.
Argument 5 contains the value that entered through argument 3.
Argument 6 contains a garbage integer.
Argument 7 contains the value that entered through argument 4.
Argument 8 contains a garbage integer.
I use Visual Studio .NET 2003 to compile and link. The Fortran program is a Fortran Console application. The project has two files -- the Fortran host program and the .OBJ of the ASM file. For the latter, I assembled with TASM32 and used EDITBIN to convert the format.
With the same code (both Fortran and ASM), the Compaq Fortran compiler (which I am trying to phase out) gives the results I expect. (It returns all arguments, exactly as they were entered.)
What is Intel Fortran doing here thatthe CompaqFortran compiler isn't?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
http://en.wikipedia.org/wiki/X86_calling_conventions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
http://software.intel.com/en-us/articles/migrating-from-compaq-visual-fortran/
This is a good document to read when porting from Compq* Visual Fortran.
Wendy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have an acceptable work-around.
On the Fortran side, I define all my arguments as members of a data structure (TYPE) and create a single instance of that TYPE. The Fortran passes only one argument to the ASM, which is the address of the first member of that instance. In the ASM, all of the members are accessed as offsets from that single address, e.g., +0, +4, +8, +12. etc., from that address.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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