Commit a7ad6c2d by Tobias Burnus Committed by Tobias Burnus

re PR fortran/40309 (gfortran does not support static c/d-tors.)

2009-06-01  Tobias Burnus  <burnus@net-b.de>

       PR fortran/40309
       * trans-decl.c (gfc_sym_identifier): Use "MAIN__" for PROGRAM "main".
       (create_main_function): Set main_identifier_node.

From-SVN: r148035
parent 75afccba
2009-06-01 Tobias Burnus <burnus@net-b.de>
PR fortran/40309
* trans-decl.c (gfc_sym_identifier): Use "MAIN__" for PROGRAM "main".
(create_main_function): Set main_identifier_node.
2009-05-29 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> 2009-05-29 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/40019 PR fortran/40019
......
...@@ -289,7 +289,10 @@ gfc_get_label_decl (gfc_st_label * lp) ...@@ -289,7 +289,10 @@ gfc_get_label_decl (gfc_st_label * lp)
static tree static tree
gfc_sym_identifier (gfc_symbol * sym) gfc_sym_identifier (gfc_symbol * sym)
{ {
return (get_identifier (sym->name)); if (sym->attr.is_main_program && strcmp (sym->name, "main") == 0)
return (get_identifier ("MAIN__"));
else
return (get_identifier (sym->name));
} }
...@@ -3874,6 +3877,8 @@ create_main_function (tree fndecl) ...@@ -3874,6 +3877,8 @@ create_main_function (tree fndecl)
tmp = build_function_type_list (integer_type_node, integer_type_node, tmp = build_function_type_list (integer_type_node, integer_type_node,
build_pointer_type (pchar_type_node), build_pointer_type (pchar_type_node),
NULL_TREE); NULL_TREE);
main_identifier_node = get_identifier ("main");
ftn_main = build_decl (FUNCTION_DECL, main_identifier_node, tmp);
ftn_main = build_decl (FUNCTION_DECL, get_identifier ("main"), tmp); ftn_main = build_decl (FUNCTION_DECL, get_identifier ("main"), tmp);
DECL_EXTERNAL (ftn_main) = 0; DECL_EXTERNAL (ftn_main) = 0;
TREE_PUBLIC (ftn_main) = 1; TREE_PUBLIC (ftn_main) = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment