- #1
saleemhasan
- 9
- 0
Hello,
I had started an earlier thread on porting this same program to linux. In that thread I had asked about padding (align) issues. It may turn out that the padding messages may only be warnings and I have shelved that problem. A more critical issue is the one error on ambiguous use of intrinsic Real.
Ambiguous use of intrinsic `REAL' at (^) [info -f g77 M CMPAMBIG]
maindpx.f:2862:
HD(I,J) = DCMPLX(DBLE(REAL(H(I,J))),DBLE(DIMAG(H(I,J))))
^
Ambiguous use of intrinsic `REAL' at (^) [info -f g77 M CMPAMBIG]
make: *** [maindpx.o] Error 1
I went to the info page for gcc
http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/CMPAMBIG.html
From what I could decipher, f90 interprets the use of intrinsic Real differently than other compilers. The gcc.gnu page also gives two different compile commands for f90 and nof90 interpretation.
James Craig Burley, who presumably wrote the man page, graciously included a short fortran program that can identify whether the compiler uses the f90 interpretation or the nof90. This will allow me to identify how the Real is interpreted on the compiler where our program runs fine. I will also run the short program by JC Burley on the linux to determine its interpretation.
PROGRAM JCB003
C
C Written by James Craig Burley 1997-02-23.
C
C Determine how compilers handle non-standard REAL
C and AIMAG on DOUBLE COMPLEX operands.
C
DOUBLE COMPLEX Z
REAL R
Z = (3.3D0, 4.4D0)
R = Z
CALL DUMDUM(Z, R)
R = REAL(Z) - R
IF (R .NE. 0.) PRINT *, 'REAL() is Fortran 90'
IF (R .EQ. 0.) PRINT *, 'REAL() is not Fortran 90'
R = 4.4D0
CALL DUMDUM(Z, R)
R = AIMAG(Z) - R
IF (R .NE. 0.) PRINT *, 'AIMAG() is Fortran 90'
IF (R .EQ. 0.) PRINT *, 'AIMAG() is not Fortran 90'
END
C
C Just to make sure compiler doesn't use naive flow
C analysis to optimize away careful work above,
C which might invalidate results...
C
SUBROUTINE DUMDUM(Z, R)
DOUBLE COMPLEX Z
REAL R
END
I tried to compile this program on linux and got three types of errors
[hasan@dual ~]$ f77 ambig.f
ambig.f:3:
C Written by James Craig Burley 1997-02-23.
^
Invalid form for PROGRAM statement at (^)
ambig.f: In program `MAIN__':
ambig.f:13:
R = REAL(Z) - R
^
Ambiguous use of intrinsic `REAL' at (^) [info -f g77 M CMPAMBIG]
ambig.f:18:
R = AIMAG(Z) - R
^
Ambiguous use of intrinsic `AIMAG' at (^) [info -f g77 M CMPAMBIG]
ambig.f: Outside of any program unit:
ambig.f:22:
C
^
Continuation indicator at (^) invalid on first non-comment line of file or following END or INCLUDE [info -f g77 M LEX]
ambig.f:23:
C Just to make sure compiler doesn't use naive flow
I do not know anything about the first error. The second one about Ambiguous use is the problem that I am trying to solve. It appears when I compile our program on linux. The third error, continuation indicator - C (comment line) is on the 6th column. It may be appearing due to some earlier problem
I would appreciate it if someone could help interpret these error messages and to get the program to compile. I will try the two different commands (for f90 and nof90 interpretation) with this program to resolve the ambiguity issue. However, I cannot do that until the other errors have been corrected.
I copied the JC Burley program from the internet and pasted it into notepad in windows and saved it as a text file so that there would not be problems with control characters such as new line or carriage return. Later, I copied and pasted it into a file using the vi editor.
Thank you.
Edit: As expected, when I compile the JC Burley program with f90 or nof90 commands, the ambiguity error goes away. However, the Invalid form for PROGRAM statement error and the continuation indication errors remain.
I had started an earlier thread on porting this same program to linux. In that thread I had asked about padding (align) issues. It may turn out that the padding messages may only be warnings and I have shelved that problem. A more critical issue is the one error on ambiguous use of intrinsic Real.
Ambiguous use of intrinsic `REAL' at (^) [info -f g77 M CMPAMBIG]
maindpx.f:2862:
HD(I,J) = DCMPLX(DBLE(REAL(H(I,J))),DBLE(DIMAG(H(I,J))))
^
Ambiguous use of intrinsic `REAL' at (^) [info -f g77 M CMPAMBIG]
make: *** [maindpx.o] Error 1
I went to the info page for gcc
http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/CMPAMBIG.html
From what I could decipher, f90 interprets the use of intrinsic Real differently than other compilers. The gcc.gnu page also gives two different compile commands for f90 and nof90 interpretation.
James Craig Burley, who presumably wrote the man page, graciously included a short fortran program that can identify whether the compiler uses the f90 interpretation or the nof90. This will allow me to identify how the Real is interpreted on the compiler where our program runs fine. I will also run the short program by JC Burley on the linux to determine its interpretation.
PROGRAM JCB003
C
C Written by James Craig Burley 1997-02-23.
C
C Determine how compilers handle non-standard REAL
C and AIMAG on DOUBLE COMPLEX operands.
C
DOUBLE COMPLEX Z
REAL R
Z = (3.3D0, 4.4D0)
R = Z
CALL DUMDUM(Z, R)
R = REAL(Z) - R
IF (R .NE. 0.) PRINT *, 'REAL() is Fortran 90'
IF (R .EQ. 0.) PRINT *, 'REAL() is not Fortran 90'
R = 4.4D0
CALL DUMDUM(Z, R)
R = AIMAG(Z) - R
IF (R .NE. 0.) PRINT *, 'AIMAG() is Fortran 90'
IF (R .EQ. 0.) PRINT *, 'AIMAG() is not Fortran 90'
END
C
C Just to make sure compiler doesn't use naive flow
C analysis to optimize away careful work above,
C which might invalidate results...
C
SUBROUTINE DUMDUM(Z, R)
DOUBLE COMPLEX Z
REAL R
END
I tried to compile this program on linux and got three types of errors
[hasan@dual ~]$ f77 ambig.f
ambig.f:3:
C Written by James Craig Burley 1997-02-23.
^
Invalid form for PROGRAM statement at (^)
ambig.f: In program `MAIN__':
ambig.f:13:
R = REAL(Z) - R
^
Ambiguous use of intrinsic `REAL' at (^) [info -f g77 M CMPAMBIG]
ambig.f:18:
R = AIMAG(Z) - R
^
Ambiguous use of intrinsic `AIMAG' at (^) [info -f g77 M CMPAMBIG]
ambig.f: Outside of any program unit:
ambig.f:22:
C
^
Continuation indicator at (^) invalid on first non-comment line of file or following END or INCLUDE [info -f g77 M LEX]
ambig.f:23:
C Just to make sure compiler doesn't use naive flow
I do not know anything about the first error. The second one about Ambiguous use is the problem that I am trying to solve. It appears when I compile our program on linux. The third error, continuation indicator - C (comment line) is on the 6th column. It may be appearing due to some earlier problem
I would appreciate it if someone could help interpret these error messages and to get the program to compile. I will try the two different commands (for f90 and nof90 interpretation) with this program to resolve the ambiguity issue. However, I cannot do that until the other errors have been corrected.
I copied the JC Burley program from the internet and pasted it into notepad in windows and saved it as a text file so that there would not be problems with control characters such as new line or carriage return. Later, I copied and pasted it into a file using the vi editor.
Thank you.
Edit: As expected, when I compile the JC Burley program with f90 or nof90 commands, the ambiguity error goes away. However, the Invalid form for PROGRAM statement error and the continuation indication errors remain.
Last edited: