Jerry DeLisle wrote:
> Tobias Burnus wrote:

>> @@ -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;
>>
>>
> Tobias and Dave,
> 
> I tested the above on x86-64 Linux.  OK to commit.

  I just took a second look at this.  We surely didn't mean to build two decls
and throw one away, did we?  I think the second assignment to ftn_main was
supposed to have been deleted when the middle argument was changed.  It looks
harmless but superfluous to me.  I'll just double-check that removing it
doesn't break anything.  Ok if so?

gcc/fortran/ChangeLog

        * trans-decl.c (create_main_function):  Don't build main decl twice.

    cheers,
      DaveK
Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c	(revision 148276)
+++ gcc/fortran/trans-decl.c	(working copy)
@@ -3876,7 +3876,6 @@
 				   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;
   TREE_STATIC (ftn_main) = 1;

Reply via email to