* [Bug fortran/53818] -fno-automatic cannot have initializer
2012-06-30 11:38 [Bug fortran/53818] New: -fno-automatic cannot have initializer j.moyard at voila dot fr
@ 2012-06-30 13:38 ` steven at gcc dot gnu.org
2012-06-30 13:51 ` j.moyard at voila dot fr
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu.org @ 2012-06-30 13:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53818
Steven Bosscher <steven at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |steven at gcc dot gnu.org
--- Comment #1 from Steven Bosscher <steven at gcc dot gnu.org> 2012-06-30 13:38:10 UTC ---
What version of gfortran are you using? (gfortran --version)
If you're using the standard RH5.7 gfortran, it's probably version 4.1.x, which
is from the days that the environment was still clean and dinosaurs still
roamed the earth. Well, almost anyway. Try upgrading.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/53818] -fno-automatic cannot have initializer
2012-06-30 11:38 [Bug fortran/53818] New: -fno-automatic cannot have initializer 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
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: j.moyard at voila dot fr @ 2012-06-30 13:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53818
--- Comment #2 from johnjohn <j.moyard at voila dot fr> 2012-06-30 13:51:13 UTC ---
(In reply to comment #1)
> What version of gfortran are you using? (gfortran --version)
>
> If you're using the standard RH5.7 gfortran, it's probably version 4.1.x, which
> is from the days that the environment was still clean and dinosaurs still
> roamed the earth. Well, almost anyway. Try upgrading.
No no, the problem does not appear with the gfortran 4.1.x packaged with Red
Hat, The problem appears with another gfortran version 4.6.0.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/53818] -finit-local-zero -fno-automatic: Function result cannot have initializer
2012-06-30 11:38 [Bug fortran/53818] New: -fno-automatic cannot have initializer 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 ` burnus at gcc dot gnu.org
2012-06-30 14:41 ` burnus at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-06-30 14:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53818
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-06-30
CC| |burnus at gcc dot gnu.org
Summary|-fno-automatic cannot have |-finit-local-zero
|initializer |-fno-automatic: Function
| |result cannot have
| |initializer
Ever Confirmed|0 |1
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-06-30 14:31:29 UTC ---
(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);
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/53818] -finit-local-zero -fno-automatic: Function result cannot have initializer
2012-06-30 11:38 [Bug fortran/53818] New: -fno-automatic cannot have initializer j.moyard at voila dot fr
` (2 preceding siblings ...)
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
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-06-30 14:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53818
--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-06-30 14:41:08 UTC ---
Draft patch - completely untested.
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -10271,3 +10330,3 @@ apply_default_init_local (gfc_symbol *sym)
if (sym->attr.save || sym->ns->save_all
- || (gfc_option.flag_max_stack_var_size == 0
+ || (gfc_option.flag_max_stack_var_size == 0 && !sym->attr.result
&& (!sym->attr.dimension || !is_non_constant_shape_array (sym))))
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/53818] -finit-local-zero -fno-automatic: Function result cannot have initializer
2012-06-30 11:38 [Bug fortran/53818] New: -fno-automatic cannot have initializer j.moyard at voila dot fr
` (3 preceding siblings ...)
2012-06-30 14:41 ` burnus at gcc dot gnu.org
@ 2012-07-05 16:33 ` j.moyard at voila dot fr
2013-02-15 8:51 ` burnus at gcc dot gnu.org
2013-02-15 8:52 ` burnus at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: j.moyard at voila dot fr @ 2012-07-05 16:33 UTC (permalink / raw)
To: gcc-bugs
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!
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/53818] -finit-local-zero -fno-automatic: Function result cannot have initializer
2012-06-30 11:38 [Bug fortran/53818] New: -fno-automatic cannot have initializer j.moyard at voila dot fr
` (4 preceding siblings ...)
2012-07-05 16:33 ` j.moyard at voila dot fr
@ 2013-02-15 8:51 ` burnus at gcc dot gnu.org
2013-02-15 8:52 ` burnus at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-02-15 8:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53818
--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-02-15 08:50:43 UTC ---
Author: burnus
Date: Fri Feb 15 08:50:37 2013
New Revision: 196073
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196073
Log:
2013-02-15 Tobias Burnus <burnus@net-b.de>
PR fortran/53818
* resolve.c (apply_default_init_local): Don't create an
initializer for a result variable.
2013-02-15 Tobias Burnus <burnus@net-b.de>
PR fortran/53818
* gfortran.dg/init_flag_11.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/init_flag_11.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/53818] -finit-local-zero -fno-automatic: Function result cannot have initializer
2012-06-30 11:38 [Bug fortran/53818] New: -fno-automatic cannot have initializer j.moyard at voila dot fr
` (5 preceding siblings ...)
2013-02-15 8:51 ` burnus at gcc dot gnu.org
@ 2013-02-15 8:52 ` burnus at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-02-15 8:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53818
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |burnus at gcc dot gnu.org
Resolution| |FIXED
--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-02-15 08:52:32 UTC ---
Finally FIXED – the approval was quite a while ago
http://gcc.gnu.org/ml/fortran/2012-07/msg00003.html
Thanks for the bugreport and sorry for the delay.
^ permalink raw reply [flat|nested] 8+ messages in thread