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

I don' t have the expected result, IERR Error

Zang_Lee
Beginner
339 Views

Hi, I have installed VS2013 and Intel Parallel Studio XE 2013 in Windows 7, 64 bit Laptop.

I have some fortran 77 code that I have been using for so Long. I want to recompile them using Intel Parallel Studio XE 2013.

When I compile one of them with Intel Visual Fortran, it' s compiled. But I don't have the expected result, because the end-of-file condition occurs. (IERR Error)  ERROR !!! QSORT : IERR = ****.

QSORT is a subroutine in my .f source file.

     CALL QSORT(NSR,NK,MSF,IERR)
C---------------------------------------------------------------
      IF(IERR.EQ.0) GOTO 300
      WRITE(*,290) IERR
  290 FORMAT(1X,'ERROR !!! QSORT: IERR  =',I6)
      GOTO 999
C

Thanks in advance for any help.

0 Kudos
1 Solution
Les_Neilson
Valued Contributor II
339 Views

Are you calling the Intel QSORT or another (your own?) version?

From the Intel help for QSORT the fourth argument (your IERR) is not a variable but a "Integer*2 name of a user-defined ordering function that determines sort order"

I suspect that your f77 code is calling another version of QSORT.

You should search your f77 code for an existing QSORT and it would help if you showed more surrounding information - for example the whole of the subprogram which calls QSORT (or at least that part up to the call, especially the declarations of the variables.

What are the values of NK and MSF before the call?

NSR should be a one dimensional array of size NK.

MSF determines the size in bytes of a single element of NSR.

Les

View solution in original post

0 Kudos
2 Replies
Les_Neilson
Valued Contributor II
340 Views

Are you calling the Intel QSORT or another (your own?) version?

From the Intel help for QSORT the fourth argument (your IERR) is not a variable but a "Integer*2 name of a user-defined ordering function that determines sort order"

I suspect that your f77 code is calling another version of QSORT.

You should search your f77 code for an existing QSORT and it would help if you showed more surrounding information - for example the whole of the subprogram which calls QSORT (or at least that part up to the call, especially the declarations of the variables.

What are the values of NK and MSF before the call?

NSR should be a one dimensional array of size NK.

MSF determines the size in bytes of a single element of NSR.

Les

0 Kudos
Les_Neilson
Valued Contributor II
339 Views

OK looking at the code for QSORT the variable IERR is only set in one place - to the value -2

Which means that if IERR is not set before you call QSORT and the subroutine completes successfully then IERR will have some value left over in memory which is unlikely to be zero.

It may be your f77 code relies on uninitialized variables being set to zero.

This is not true of all compilers, and you should resist the temptation to use the compiler setting to initialise variables to zero.

You should give IERR a value (presumably zero) either before you call QSORT or at the top of QSORT.

You should compile your code with all of the debug options switched ON - e.g. uninitialized variables, array subscripts out of range etc.

Hope this helps.

Les

0 Kudos
Reply