Article ID: 77482
Article Last Modified on 12/1/2003
APPLIES TO
- Microsoft FORTRAN Compiler 4.0
- Microsoft FORTRAN Compiler 4.01
- Microsoft FORTRAN Compiler 4.1
- Microsoft FORTRAN Compiler 5.0
- Microsoft FORTRAN Compiler 5.1
- Microsoft FORTRAN Compiler 4.1
- Microsoft FORTRAN Compiler 5.0
- Microsoft FORTRAN Compiler 5.1
This article was previously published under Q77482
SYMPTOMS
A FORTRAN program that appends a Hollerith constant consisting of five or more characters to a string may cause the compiler to generate an internal compiler error.
FORTRAN 5.1 under OS/2 and DOS:
FORTRAN 5.0 under OS/2 and DOS:
FORTRAN 4.1 under OS/2, and FORTRAN 4.1 and 4.01 under DOS:
FORTRAN 4.0 and 4.0a under DOS:
RESOLUTION
The Hollerith descriptor is mainly intended to be used within a FORMAT specifier. However, it should be able to be used in any context where character constants can be used.
To avoid this internal compiler error, add the Hollerith constant to the FORMAT statement instead of the character variable assignment.
Sample code #2 below illustrates this solution.
STATUS
Microsoft has confirmed this to be a problem in Microsoft FORTRAN versions 4.0, 4.01, 4.1, 5.0, and 5.1. This problem was corrected in FORTRAN PowerStation, version 1.0.
MORE INFORMATION
Compiling the following code produces an internal compiler error:
Sample Code #1
c Compile options needed: none WRITE (*, '(17H FORTRAN Compiler)') ! This is OK PRINT *, 'MS ' // 4HFort ! This works fine PRINT *, 'MS ' // 5HFortr ! F1001 Generated here END
The same problem happens if you increase the number of characters on the Hollerith constant.
A possible solution to this problem is to append the string and Hollerith constant in a FORMAT specifier. An alternative is to define the whole string inside the FORMAT and then write it out.
The following code illustrates these solutions:
Sample Code #2
CHARACTER*4 String String = ' MS ' 100 FORMAT ( A4 , 10HC Compiler) ! appending the string c in FORMAT specifier 200 FORMAT (' MS ' 16HFortran Compiler) ! defining entire string c inside the FORMAT PRINT 100, String PRINT 200 END
Additional query words: 4.00 4.10 5.00 5.10 fixlist1.00 buglist5.10 buglist5.00 buglist4.10 buglist4.01 buglist4.00
Keywords: KB77482