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]

[gfortran,patch] Set main_identifier_node


Hi all,

I intend to commit the following patch in a few days, unless there are
objections. This allows the middle-end to know that MAIN__ is the main
entry point of the Fortran program. This allows better call graphs to
be generated, e.g. -fwhole-program will not remove it (mostly useless
for now, due to the well-known multiple function decls issue) and
probably allows more correct debug info.

Bootstrapped on x86_64-linux, currently regtesting.

FX



2007-08-18  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

        * parse.c (main_program_symbol): Set main_identifier_node.



Index: gcc/fortran/parse.c
===================================================================
--- gcc/fortran/parse.c (revision 128516)
+++ gcc/fortran/parse.c (working copy)
@@ -21,6 +21,8 @@ along with GCC; see the file COPYING3.

 #include "config.h"
 #include "system.h"
+#include "coretypes.h"
+#include "tree.h"
 #include <setjmp.h>
 #include "gfortran.h"
 #include "match.h"
@@ -1238,6 +1240,9 @@ main_program_symbol (gfc_namespace *ns)
   gfc_symbol *main_program;
   symbol_attribute attr;

+  /* Let backend know that this is the main entry point to the program.  */
+  main_identifier_node = get_identifier ("MAIN__");
+
   gfc_get_symbol ("MAIN__", ns, &main_program);
   gfc_clear_attr (&attr);
   attr.flavor = FL_PROCEDURE;


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