------- Comment #1 from dave dot korn dot cygwin at gmail dot com 2009-05-30 15:01 -------
It's not entirely straightforward, it seems. An earlier attempt appears to have fizzled out: http://gcc.gnu.org/ml/fortran/2007-09/threads.html#00289 I do not yet understand Andrew Pinski's objection: " This is wrong as it causes the middle-end to also emitt a call to __main inside MAIN__. Now you will get two calls to __main which calls the global constructors now twice. " as I don't understand what the "also" refers to. Right now there are precisely no calls to __main at all. Perhaps there used to be an actual C-linkage main function in libgfortran. Yes, wait a minute, this is what libgfortranbegin used to get us, is it not? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40309