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
This commit is contained in:
Tobias Burnus 2009-06-01 09:00:35 +02:00 committed by Tobias Burnus
parent 75afccba06
commit a7ad6c2d61
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,9 @@
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>
PR fortran/40019

View File

@ -289,7 +289,10 @@ gfc_get_label_decl (gfc_st_label * lp)
static tree
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)
tmp = build_function_type_list (integer_type_node, integer_type_node,
build_pointer_type (pchar_type_node),
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);
DECL_EXTERNAL (ftn_main) = 0;
TREE_PUBLIC (ftn_main) = 1;