From: rfengineer55 on 9 Jun 2010 11:24 I need a resource that eplains how to use gfortran to debug a compilable fortran program with logic problems. Several of my programs from the FCC give me errors like the following : AM_ GWAV 1 <--- This is the real Main INTEGER S 2 <-- This statement is in a Subroutine after the real Main Two main programs at <1> and <2> Huh? Usually this happens when the subroutine declaration starts in the wrong column, or the preceding code is so riddled with errors that the compiler gets confised. These troubleshooting tricks don't seem to work. BTW, there is a real neat little command line utility called Finchech that will scan your source code and look for syntax problems that will gag your compiler. Unfortunately this utility is of no help with this problem. What's your favorite trickfor solving these problems? RF Engineer 55
From: mecej4 on 9 Jun 2010 12:07 On 6/9/2010 10:24 AM, rfengineer55 wrote: > I need a resource that eplains how to use gfortran to debug a > compilable fortran program with logic problems. Several of my programs > from the FCC give me errors like the following : > > > AM_ GWAV 1<--- This is the real Main > > INTEGER S 2<-- This statement is in a Subroutine after > the real Main > > > Two main programs at<1> and<2> > > Huh? > > Usually this happens when the subroutine declaration starts in the > wrong column, or the preceding code is so riddled with errors that the > compiler gets confised. These troubleshooting tricks don't seem to > work. > > BTW, there is a real neat little command line utility called Finchech > that will scan your source code and look for syntax problems that will > gag your compiler. Unfortunately this utility is of no help with this > problem. > > What's your favorite trickfor solving these problems? My favorite trick: RTFM -- mecej4
From: steve on 9 Jun 2010 12:52 On Jun 9, 8:24 am, rfengineer55 <rfenginee...(a)aol.com> wrote: > I need a resource that eplains how to use gfortran to debug a > compilable fortran program with logic problems. Several of my programs > from the FCC give me errors like the following : > > AM_ GWAV 1 <--- This is the real Main > > INTEGER S 2 <-- This statement is in a Subroutine after > the real Main > > Two main programs at <1> and <2> > > Huh? Use the following set of options: -Wall -Werror -fbounds-check -fmax-errors=1 The last option will abort compilation after the first detected error and prevents the runaway cascade of error messages. -- steve
From: glen herrmannsfeldt on 9 Jun 2010 14:00 rfengineer55 <rfengineer55(a)aol.com> wrote: > I need a resource that eplains how to use gfortran to debug a > compilable fortran program with logic problems. Several of my programs > from the FCC give me errors like the following : > AM_ GWAV 1 <--- This is the real Main > INTEGER S 2 <-- This statement is in a Subroutine after > the real Main > Two main programs at <1> and <2> > Huh? Before the PROGRAM statement was added in Fortran 77, any routine without a SUBROUTINE or FUNCTION statement was main. (And the PROGRAM statement is still optional.) > Usually this happens when the subroutine declaration starts in the > wrong column, or the preceding code is so riddled with errors that the > compiler gets confised. These troubleshooting tricks don't seem to > work. There is no point in trying to link until syntax errors are removed from the source. Look for the error messages, fix the errors, and then recompile. (I believe the 'two main programs' message is from the linker.) > BTW, there is a real neat little command line utility called Finchech > that will scan your source code and look for syntax problems that will > gag your compiler. Unfortunately this utility is of no help with this > problem. > What's your favorite trickfor solving these problems? If compiling a large number of routines, generating a large listing file with hidden error messages, I use grep to find such messages. (There is a WIN32 version of grep in case you need one.) If you are especially unlucky your failed SUBROUTINE statement may turn into a legal statement. That would be pretty rare, though. If you really are missing the SUBROUTINE or FUNCTION statement then the resulting syntax is likely legal. -- glen
|
Pages: 1 Prev: VAX VMS Fortran to Fortran 77 Next: VAX VMS Fortran Source |