FIX: R6003 or Hang Debugging FORTRAN COMPLEX Array

ID: Q94575

4.00 4.01 4.05 | 4.00 4.01

MS-DOS         | WINDOWS
kbtool kbcode kberrmsg kbbuglist kbfixlist

The information in this article applies to:

SYMPTOMS

An attempt to debug with CodeView an application developed with Microsoft FORTRAN fails when CodeView terminates with an error or causes the machine to halt. This error occurs with applications developed only with FORTRAN and those developed using another language with FORTRAN code.

When debugging the FORTRAN code in MS-DOS, CodeView may generate the following error message:

   run-time error R6003
   - integer divide by 0

When debugging the FORTRAN code in Windows, the computer may hang and stop responding until the computer is rebooted.

CAUSE

The FORTRAN code declares and uses an array of COMPLEX numbers.

RESOLUTION

To work around this problem, step over calls to FORTRAN modules that contains an array of COMPLEX numbers. In most cases, CodeView can debug the remainder of the code in the application without any problems.

STATUS

Microsoft has confirmed this to be a problem in CodeView versions 4.0, 4.01, and 4.05 for MS-DOS and versions 4.0 and 4.01 for Windows. This problem was corrected in CodeView version 4.1.

MORE INFORMATION

To reproduce this problem in an application developed for the MS-DOS environment, compile and debug the following mixed-language project. To reproduce this problem in an application developed for the Microsoft Windows environment, link the FORTRAN object file into the GENERIC sample application provided with Microsoft C/C++ versions 7.0 and 7.0a and with the Microsoft Windows Software Development Kit (SDK).

Microsoft CodeView version 4.1 does not have this problem, however since the C++ and C expression evaluators do not support complex data types, they are not displayed correctly.

Sample Code #1: CMIX.C: C Main Program

/*
 * Compile options needed: None
 */ 

void extern far FORTRAN sub1(void);

void main(void)
{
   sub1();
}

Sample Code #2: FORTMIX.FOR: FORTRAN Subroutine

C Compile options needed: None

      SUBROUTINE SUB1
      COMPLEX A(1)
      A(1)=(1.0,1.0)
      END

Sample Code #3: MAKEFILE

# Make options needed: None

all: cmix.exe

fortmix.obj: fortmix.for

   fl /c /Zi /Od /Gs fortmix.for

cmix.obj: cmix.c
   cl /c /Zi /Od /Gs /AL cmix.c

cmix.exe: cmix.obj fortmix.obj
   link cmix fortmix,, nul, /co /noe /nod llibc7 llibf7rc oldnames;

Additional reference words: 4.00 KBCategory: kbtool kbcode kberrmsg kbbuglist kbfixlist KBSubcategory: CvwIss
Keywords          : kb16bitonly 
Solution Type     : kbfix

Last Reviewed: September 17, 1997