[fortran] Different FUNC_DECLS with the same DECL_NAME - MAIN__ and named PROGRAM main functions [was Re: gcc-4.5-20090528 is now available]

Dave Korn dave.korn.cygwin@googlemail.com
Mon Jun 8 15:52:00 GMT 2009


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fortran-double-decl-main.diff
Type: text/x-c
Size: 520 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090608/00f31fbd/attachment.bin>


More information about the Fortran mailing list