public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "j.moyard at voila dot fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/53818] -finit-local-zero -fno-automatic: Function result cannot have initializer
Date: Thu, 05 Jul 2012 16:33:00 -0000	[thread overview]
Message-ID: <bug-53818-4-mAihzgrD7Z@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53818-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53818

--- Comment #5 from johnjohn <j.moyard at voila dot fr> 2012-07-05 16:32:44 UTC ---
(In reply to comment #3)
> (In reply to comment #0)
> > But when I integrate '-fno-automatic' option, I obtain this error message :
> > function testing(date1, date2) result(test)
> >                                           1
> > Error: Function result 'test' at (1) cannot have an initializer
> 
> I helps if you tell up all options. The issue seemingly only occurs with
> -fno-automatic *and* -finit-local-zero (or -finit-logical=true|false).
> 
> 
> Two things surprise me:
> 
> a) Why are there two initializer, when looking at the dump
> (-fdump-tree-original). (Requires that one does not have -fno-automatic) - the
> should be only one, shouldn't it?
> 
> 
> b) Why does this only trigger with -fno-automatic? The code currently has the
> following. At a glance, it should always trigger and the
> apply_default_init_local should be after the checks (together with the
> simplify):
> 
> resolve_fl_variable (gfc_symbol *sym, int mp_flag)
> ...
>   if (sym->value == NULL && sym->attr.referenced)
>     apply_default_init_local (sym); /* Try to apply a default initialization. 
> */
> ...
>   /* Reject illegal initializers.  */
>   if (!sym->mark && sym->value)
> ...
>       else if (sym->attr.result)
>         gfc_error ("Function result '%s' at %L cannot have an initializer",
>                    sym->name, &sym->declared_at);

Yes in fact, I use finit-local with fno-automatic!


  parent reply	other threads:[~2012-07-05 16:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-30 11:38 [Bug fortran/53818] New: -fno-automatic " j.moyard at voila dot fr
2012-06-30 13:38 ` [Bug fortran/53818] " steven at gcc dot gnu.org
2012-06-30 13:51 ` j.moyard at voila dot fr
2012-06-30 14:32 ` [Bug fortran/53818] -finit-local-zero -fno-automatic: Function result " burnus at gcc dot gnu.org
2012-06-30 14:41 ` burnus at gcc dot gnu.org
2012-07-05 16:33 ` j.moyard at voila dot fr [this message]
2013-02-15  8:51 ` burnus at gcc dot gnu.org
2013-02-15  8:52 ` burnus at gcc dot gnu.org

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=bug-53818-4-mAihzgrD7Z@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).