This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Extra 'main' symbol with 4.5.2 -- invalid code?
- From: Matt Fago <fago at earthlink dot net>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: fortran at gcc dot gnu dot org
- Date: Mon, 17 Jan 2011 13:26:42 -0700 (GMT-07:00)
- Subject: Re: Extra 'main' symbol with 4.5.2 -- invalid code?
- Reply-to: Matt Fago <fago at earthlink dot net>
Tobias Burnus wrote:
> As this shows, the INTERFACE block belongs to the main program - there
> is no "global interface block"; an interface is always restricted to a
> MODULE, a SUBROUTINE, a FUNCTION or - as in this example - to the main
> program.
>
> If you want to make an interface available, it is best to put the
> INTERFACE - or better the procedure itself - into a MODULE and USE
> associate it.
>
> Tobias
>
> PS: The official definition of a "11.1 Main program" in Fortran 2008 is:
> "A Fortran main program is a program unit that does not contain a
> SUBROUTINE, FUNCTION, MODULE,
> SUBMODULE, or BLOCK DATA statement as its first statement.
> R1101 main-program is [ program-stmt ]
> [ specication-part ]
> [ execution-part ]
> [ internal-subprogram-part ]
> end-program-stmt
> R1102 program-stmt is PROGRAM program-name
> R1103 end-program-stmt is END [ PROGRAM [ program-name ] ]
Ah, thank you.
What was actually happening in gfortran 4.4 is a Fortran MAIN__ was being
created (with only the interface blocks) without a corresponding C 'main.'
The interface blocks were thus essentially ignored.
So, an improvement in gcc 4.5, pointing to an issue in my code. Once again,
another reason why gcc is so useful.
Thank all!
Matt