This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[gfortran,patch] Set main_identifier_node
- From: "François-Xavier Coudert" <fxcoudert at gmail dot com>
- To: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 18 Sep 2007 16:55:26 +0100
- Subject: [gfortran,patch] Set main_identifier_node
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=XMLC2nmXuHZPTWO8iou+AOxCAlV8Rnb5RJV36ckvwhs=; b=kom7vsnAW/yEQYlZaI8pMEeTKU+LfoTlspVw4S9p4fs7hYEFH4m8fPO9O86kKov8bBWrGg0p5+K0JxFVzy/z/XggKx1AaI6Kb1fPfXCifOCudkdUBrN+QKl58G1ARf0WufKE4PjWQL9X5qmpo6zXCfKNLQVK7KsMKjwDlsdNz3c=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=DbFXTaEQp/mkSHagOudYyfCD7Nyf351VHIKFgih0sGT757NBv0MVBg2F1r7XL+cDCG7hNr8hNYkaWKL4MHHxyaknnWoX8KTU+MUy1xEcHerg1TehiraWPYqY5Am+DlrYHlsvPne2OEnIuV9pJNIaxKpovLWfYEJj5ck39lQ5Voo=
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;