This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Extra 'main' symbol with 4.5.2 -- invalid code?


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 ]
> [ specication-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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]