summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2007-10-03 21:27:39 +0000
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2007-10-03 21:27:39 +0000
commit2994236dfb5f9bee8fbf02b1b59d5acdf0037fbd (patch)
tree900c7186f4476f1eadb33a7b9c035c04d002cd40
parent0b7780cd31e6facd2efd76b717f64d1e4a6ee231 (diff)
downloadppe42-gcc-2994236dfb5f9bee8fbf02b1b59d5acdf0037fbd.tar.gz
ppe42-gcc-2994236dfb5f9bee8fbf02b1b59d5acdf0037fbd.zip
PR fortran/26682
* trans-decl.c (build_function_decl): Set "externally_visible" attribute on the MAIN program decl. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128993 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-decl.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 226c50a20fe..cb9c9ca964f 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2007-10-03 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/26682
+ * trans-decl.c (build_function_decl): Set "externally_visible"
+ attribute on the MAIN program decl.
+
2007-10-03 Tobias Schlüter <tobi@gcc.gnu.org>
PR fortran/33198
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index f04a4d1b904..5b6b88bde63 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -1321,6 +1321,12 @@ build_function_decl (gfc_symbol * sym)
TREE_SIDE_EFFECTS (fndecl) = 0;
}
+ /* For -fwhole-program to work well, MAIN__ needs to have the
+ "externally_visible" attribute. */
+ if (attr.is_main_program)
+ DECL_ATTRIBUTES (fndecl)
+ = tree_cons (get_identifier("externally_visible"), NULL_TREE, NULL_TREE);
+
/* Layout the function declaration and put it in the binding level
of the current function. */
pushdecl (fndecl);
OpenPOWER on IntegriCloud