Dear Fortrunners: The following code has two very common errors, but complies without errors or warnings: (1) a complex-to-real assignment without explicit REALPART(); (2) a subroutine call with an erroneous real-array arg in place of a complex-arrray arg.
PROGRAM TESTCMPL IMPLICIT NONE REAL R,RA(2) COMPLEX C C=COMPLEX(1.0,1.0) R=C WRITE(*,*) 'C=',C,' -> R=',R RA(1)=1.0 RA(2)=2.0 WRITE(*,*) 'CALLS AS:',RA(1),RA(2) CALL ARRAY(RA) STOP END SUBROUTINE ARRAY(CA) IMPLICIT NONE COMPLEX CA(2) WRITE(*,*) 'CALLED AS:',CA(1),CA(2) RETURN END Here is the console output: >g77 -mno-cygwin -O -fbounds-check -ftrapv -W -Wall -Wsurprising -pedantic -o >testcmpl.exe testcmpl.f >testcmpl C= (1.,1.) -> R= 1. CALLS AS: 1. 2. CALLED AS: (1.,2.) (7.72198524E+033,1.) g77 should give errors or warnings, because these errors are very common in real life. I suffered for one week locating these :-) Cheeeeeers -- Summary: g77 fails to warn critical real/complex assignment errors Product: gcc Version: 3.4.4 Status: UNCONFIRMED Severity: major Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ohyeahq at yahoo dot co dot jp http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35348