From: Dave Korn <dave.korn.cygwin@googlemail.com>
To: Tobias Burnus <burnus@net-b.de>
Cc: Dave Korn <dave.korn.cygwin@googlemail.com>,
Angelo Graziosi <angelo.graziosi@alice.it>,
Fortran <fortran@gcc.gnu.org>,
"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: [fortran] Different FUNC_DECLS with the same DECL_NAME - MAIN__ and named PROGRAM main functions [was Re: gcc-4.5-20090528 is now available]
Date: Sat, 30 May 2009 19:07:00 -0000 [thread overview]
Message-ID: <4A217895.9060708@gmail.com> (raw)
In-Reply-To: <4A2173B7.6040206@net-b.de>
Tobias Burnus wrote:
Hi Tobias,
> Hmm, that should not be the case that the middle end gets confused. I
> think there is some merit in printing also the name, e.g., HelloWorld
> rather than MAIN__ in middle end warnings ("unused variable foo in
> HelloWorld"), but otherwise the name given to the program in gimple
> shouldn't matter as long as the assembler name is MAIN__.
>
> Seemingly there are some issues; however, they do not seem to be new.
> MAIN__ was before generated and the main() was linked from the library.
> The library's main (in fmain.c / libgfortranbegin.a) should already have
> called __main(). Thus if gimple_expand_cfg() automatically adds __main()
> calls for "main" then this must have happened before.
>
>> I think this is probably an invalid way for the front-end to drive the
>> mid-end - it's ok when the two functions are semantically the same, as when
>> C++ clones constructors, but these are actually two entirely different
>> functions, and in particular, only one of them should cause
>> expand_main_function to be called. I'd like that to be the real "main"
>> function, which is where the fortran runtime init gets called, rather than
>> "MAIN__", which is the user-level main function, because the runtime init
>> itself might need to use st_printf and that won't work until __main() is
>> called, but I'm not sure how to disetangle the two now.
>>
>
> I agree that for "main" the call to "__main()" should happend and thus
> expand_main_function should be called. I'm not sure in about the exact
> assumptions of the middle end. In principle, it would be OK if the
> MAIN__ function would show up as MAIN__ in gimple/-fdump-tree-original.
> The only potential inconvenience I see, is the mentioned reference to
> MAIN__ instead of <program name> in middle-end warnings, which can
> confuse users.
Wouldn't the simplest thing be to rename the other main function - the
initialisation one that is automatically generated by create_main_function()?
It could be called anything different we liked, and it's not user-visible, so
it ought to not be a problem to rename?
cheers,
DaveK
next prev parent reply other threads:[~2009-05-30 18:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4A20F778.9010705@alice.it>
[not found] ` <4A214191.1050206@gmail.com>
[not found] ` <4A2143EA.2050904@gmail.com>
[not found] ` <4A214B46.7040405@gmail.com>
2009-05-30 18:42 ` Dave Korn
2009-05-30 18:45 ` Tobias Burnus
2009-05-30 19:07 ` Dave Korn [this message]
2009-05-30 21:11 ` Dave Korn
2009-05-31 13:32 ` Dave Korn
2009-05-31 22:44 ` Tobias Burnus
2009-06-01 1:10 ` Jerry DeLisle
2009-06-01 7:01 ` Tobias Burnus
2009-06-01 9:06 ` Dave Korn
2009-06-08 15:52 ` Dave Korn
2009-06-08 17:39 ` Tobias Burnus
2009-05-31 13:44 ` Tobias Burnus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A217895.9060708@gmail.com \
--to=dave.korn.cygwin@googlemail.com \
--cc=angelo.graziosi@alice.it \
--cc=burnus@net-b.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).