This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/53818] -finit-local-zero -fno-automatic: Function result cannot have initializer


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!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]