* [Bug fortran/29458] Spurious -Wuninitialized warning for implied do-loop counter
2006-10-13 14:03 [Bug fortran/29458] New: Spurious -Wuninitialized warning for implied do-loop counter fxcoudert at gcc dot gnu dot org
@ 2006-10-13 14:03 ` fxcoudert at gcc dot gnu dot org
2007-01-31 23:02 ` fxcoudert at gcc dot gnu dot org
` (15 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-10-13 14:03 UTC (permalink / raw)
To: gcc-bugs
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-10-13 14:03:28
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29458
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug fortran/29458] Spurious -Wuninitialized warning for implied do-loop counter
2006-10-13 14:03 [Bug fortran/29458] New: Spurious -Wuninitialized warning for implied do-loop counter fxcoudert at gcc dot gnu dot org
2006-10-13 14:03 ` [Bug fortran/29458] " fxcoudert at gcc dot gnu dot org
@ 2007-01-31 23:02 ` fxcoudert at gcc dot gnu dot org
2007-01-31 23:03 ` fxcoudert at gcc dot gnu dot org
` (14 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-01-31 23:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from fxcoudert at gcc dot gnu dot org 2007-01-31 23:01 -------
This is fixed by the following patch:
Index: trans-array.c
===================================================================
--- trans-array.c (revision 121280)
+++ trans-array.c (working copy)
@@ -1280,6 +1280,7 @@
gfc_conv_expr (&se, c->iterator->var);
gfc_add_block_to_block (pblock, &se.pre);
loopvar = se.expr;
+ TREE_NO_WARNING(loopvar) = 1;
/* Make a temporary, store the current value in that
and return it, once the loop is done. */
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |fxcoudert at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2006-10-13 14:03:28 |2007-01-31 23:01:50
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29458
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug fortran/29458] Spurious -Wuninitialized warning for implied do-loop counter
2006-10-13 14:03 [Bug fortran/29458] New: Spurious -Wuninitialized warning for implied do-loop counter fxcoudert at gcc dot gnu dot org
2006-10-13 14:03 ` [Bug fortran/29458] " fxcoudert at gcc dot gnu dot org
2007-01-31 23:02 ` fxcoudert at gcc dot gnu dot org
@ 2007-01-31 23:03 ` fxcoudert at gcc dot gnu dot org
2007-01-31 23:07 ` pinskia at gcc dot gnu dot org
` (13 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-01-31 23:03 UTC (permalink / raw)
To: gcc-bugs
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.2.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29458
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug fortran/29458] Spurious -Wuninitialized warning for implied do-loop counter
2006-10-13 14:03 [Bug fortran/29458] New: Spurious -Wuninitialized warning for implied do-loop counter fxcoudert at gcc dot gnu dot org
` (2 preceding siblings ...)
2007-01-31 23:03 ` fxcoudert at gcc dot gnu dot org
@ 2007-01-31 23:07 ` pinskia at gcc dot gnu dot org
2007-04-27 21:18 ` kargl at gcc dot gnu dot org
` (12 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-01-31 23:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2007-01-31 23:07 -------
Why not create a new i for the inner loop instead of saving it off?
Or is:
integer :: n, i
n = 5
n = sum((/(i,i=1,f())/))
contains
function f()
integer :: f
f = i+1
end
valid and well defined?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29458
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug fortran/29458] Spurious -Wuninitialized warning for implied do-loop counter
2006-10-13 14:03 [Bug fortran/29458] New: Spurious -Wuninitialized warning for implied do-loop counter fxcoudert at gcc dot gnu dot org
` (3 preceding siblings ...)
2007-01-31 23:07 ` pinskia at gcc dot gnu dot org
@ 2007-04-27 21:18 ` kargl at gcc dot gnu dot org
2007-05-14 21:30 ` mmitchel at gcc dot gnu dot org
` (11 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: kargl at gcc dot gnu dot org @ 2007-04-27 21:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from kargl at gcc dot gnu dot org 2007-04-27 22:18 -------
*** Bug 31731 has been marked as a duplicate of this bug. ***
--
kargl at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |terry at chem dot gu dot se
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29458
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug fortran/29458] Spurious -Wuninitialized warning for implied do-loop counter
2006-10-13 14:03 [Bug fortran/29458] New: Spurious -Wuninitialized warning for implied do-loop counter fxcoudert at gcc dot gnu dot org
` (4 preceding siblings ...)
2007-04-27 21:18 ` kargl at gcc dot gnu dot org
@ 2007-05-14 21:30 ` mmitchel at gcc dot gnu dot org
2007-07-20 3:49 ` mmitchel at gcc dot gnu dot org
` (10 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-05-14 21:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from mmitchel at gcc dot gnu dot org 2007-05-14 22:26 -------
Will not be fixed in 4.2.0; retargeting at 4.2.1.
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.2.0 |4.2.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29458
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug fortran/29458] Spurious -Wuninitialized warning for implied do-loop counter
2006-10-13 14:03 [Bug fortran/29458] New: Spurious -Wuninitialized warning for implied do-loop counter fxcoudert at gcc dot gnu dot org
` (5 preceding siblings ...)
2007-05-14 21:30 ` mmitchel at gcc dot gnu dot org
@ 2007-07-20 3:49 ` mmitchel at gcc dot gnu dot org
2007-08-06 13:47 ` fxcoudert at gcc dot gnu dot org
` (9 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-07-20 3:49 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.2.1 |4.2.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29458
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug fortran/29458] Spurious -Wuninitialized warning for implied do-loop counter
2006-10-13 14:03 [Bug fortran/29458] New: Spurious -Wuninitialized warning for implied do-loop counter fxcoudert at gcc dot gnu dot org
` (6 preceding siblings ...)
2007-07-20 3:49 ` mmitchel at gcc dot gnu dot org
@ 2007-08-06 13:47 ` fxcoudert at gcc dot gnu dot org
2007-08-12 20:16 ` fxcoudert at gcc dot gnu dot org
` (8 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-08-06 13:47 UTC (permalink / raw)
To: gcc-bugs
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2007-01-31 23:01:50 |2007-08-06 13:47:12
date| |
Target Milestone|4.2.2 |---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29458
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug fortran/29458] Spurious -Wuninitialized warning for implied do-loop counter
2006-10-13 14:03 [Bug fortran/29458] New: Spurious -Wuninitialized warning for implied do-loop counter fxcoudert at gcc dot gnu dot org
` (7 preceding siblings ...)
2007-08-06 13:47 ` fxcoudert at gcc dot gnu dot org
@ 2007-08-12 20:16 ` fxcoudert at gcc dot gnu dot org
2007-11-16 20:57 ` terry at chem dot gu dot se
` (7 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-08-12 20:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from fxcoudert at gcc dot gnu dot org 2007-08-12 20:15 -------
(In reply to comment #2)
> Why not create a new i for the inner loop instead of saving it off?
This is indeed what we should do; however, I can't find a way to work it out.
Unassigning myself.
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|fxcoudert at gcc dot gnu dot|unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29458
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug fortran/29458] Spurious -Wuninitialized warning for implied do-loop counter
2006-10-13 14:03 [Bug fortran/29458] New: Spurious -Wuninitialized warning for implied do-loop counter fxcoudert at gcc dot gnu dot org
` (8 preceding siblings ...)
2007-08-12 20:16 ` fxcoudert at gcc dot gnu dot org
@ 2007-11-16 20:57 ` terry at chem dot gu dot se
2008-01-30 17:59 ` bcbarnes at gmail dot com
` (6 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: terry at chem dot gu dot se @ 2007-11-16 20:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from terry at chem dot gu dot se 2007-11-16 20:57 -------
I'd just like to remind everyone that this is still an issue in gcc version
4.3.0 20071109
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29458
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug fortran/29458] Spurious -Wuninitialized warning for implied do-loop counter
2006-10-13 14:03 [Bug fortran/29458] New: Spurious -Wuninitialized warning for implied do-loop counter fxcoudert at gcc dot gnu dot org
` (9 preceding siblings ...)
2007-11-16 20:57 ` terry at chem dot gu dot se
@ 2008-01-30 17:59 ` bcbarnes at gmail dot com
2008-01-30 19:54 ` kargl at gcc dot gnu dot org
` (5 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: bcbarnes at gmail dot com @ 2008-01-30 17:59 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from bcbarnes at gmail dot com 2008-01-30 17:18 -------
This bug also shows up when executing the example code for initializing
random_seed in the gfortran documentation. Is it a regression w.r.t. 4.0 or
4.1? Maybe not, but it would be nice if something in the docs didn't generate
a warning ;)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29458
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug fortran/29458] Spurious -Wuninitialized warning for implied do-loop counter
2006-10-13 14:03 [Bug fortran/29458] New: Spurious -Wuninitialized warning for implied do-loop counter fxcoudert at gcc dot gnu dot org
` (10 preceding siblings ...)
2008-01-30 17:59 ` bcbarnes at gmail dot com
@ 2008-01-30 19:54 ` kargl at gcc dot gnu dot org
2008-01-30 20:28 ` manu at gcc dot gnu dot org
` (4 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: kargl at gcc dot gnu dot org @ 2008-01-30 19:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from kargl at gcc dot gnu dot org 2008-01-30 19:26 -------
(In reply to comment #7)
> This bug also shows up when executing the example code for initializing
> random_seed in the gfortran documentation. Is it a regression w.r.t. 4.0 or
> 4.1? Maybe not, but it would be nice if something in the docs didn't generate
> a warning ;)
No, it is not a regression w.r.t to any previous version of gfortran.
The problem has always existed. You're more than welcomed to fix it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29458
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug fortran/29458] Spurious -Wuninitialized warning for implied do-loop counter
2006-10-13 14:03 [Bug fortran/29458] New: Spurious -Wuninitialized warning for implied do-loop counter fxcoudert at gcc dot gnu dot org
` (11 preceding siblings ...)
2008-01-30 19:54 ` kargl at gcc dot gnu dot org
@ 2008-01-30 20:28 ` manu at gcc dot gnu dot org
2008-01-30 20:28 ` manu at gcc dot gnu dot org
` (3 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-01-30 20:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from manu at gcc dot gnu dot org 2008-01-30 20:13 -------
For my classification of -Wuninitialized problems (see
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings), this is caused by a
representation issue.
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu dot org
OtherBugsDependingO| |24639
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29458
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug fortran/29458] Spurious -Wuninitialized warning for implied do-loop counter
2006-10-13 14:03 [Bug fortran/29458] New: Spurious -Wuninitialized warning for implied do-loop counter fxcoudert at gcc dot gnu dot org
` (12 preceding siblings ...)
2008-01-30 20:28 ` manu at gcc dot gnu dot org
@ 2008-01-30 20:28 ` manu at gcc dot gnu dot org
2009-04-05 13:20 ` dfranke at gcc dot gnu dot org
` (2 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-01-30 20:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from manu at gcc dot gnu dot org 2008-01-30 19:53 -------
I tried this:
Index: gcc/fortran/trans-array.c
===================================================================
--- gcc/fortran/trans-array.c (revision 131893)
+++ gcc/fortran/trans-array.c (working copy)
@@ -1246,36 +1246,27 @@ gfc_trans_array_constructor_value (stmtb
tree end;
tree step;
tree loopvar;
tree exit_label;
tree loopbody;
- tree tmp2;
- tree tmp_loopvar;
loopbody = gfc_finish_block (&body);
if (c->iterator->var->symtree->n.sym->backend_decl)
{
- gfc_init_se (&se, NULL);
- gfc_conv_expr (&se, c->iterator->var);
- gfc_add_block_to_block (pblock, &se.pre);
- loopvar = se.expr;
+ loopvar = gfc_typenode_for_spec (&c->iterator->var->ts);
+ loopvar = gfc_create_var (loopvar,
c->iterator->var->symtree->n.sym->name);
}
else
{
/* If the iterator appears in a specification expression in
an interface mapping, we need to make a temp for the loop
variable because it is not declared locally. */
loopvar = gfc_typenode_for_spec (&c->iterator->var->ts);
loopvar = gfc_create_var (loopvar, "loopvar");
}
- /* Make a temporary, store the current value in that
- and return it, once the loop is done. */
- tmp_loopvar = gfc_create_var (TREE_TYPE (loopvar), "loopvar");
- gfc_add_modify_expr (pblock, tmp_loopvar, loopvar);
-
/* Initialize the loop. */
gfc_init_se (&se, NULL);
gfc_conv_expr_val (&se, c->iterator->start);
gfc_add_block_to_block (pblock, &se.pre);
gfc_add_modify_expr (pblock, loopvar, se.expr);
@@ -1293,10 +1284,12 @@ gfc_trans_array_constructor_value (stmtb
/* If this array expands dynamically, and the number of iterations
is not constant, we won't have allocated space for the static
part of C->EXPR's size. Do that now. */
if (dynamic && gfc_iterator_has_dynamic_bounds (c->iterator))
{
+ tree tmp2;
+
/* Get the number of iterations. */
tmp = gfc_get_iteration_count (loopvar, end, step);
/* Get the static part of C->EXPR's size. */
gfc_get_array_constructor_element_size (&size, c->expr);
@@ -1339,13 +1332,10 @@ gfc_trans_array_constructor_value (stmtb
gfc_add_expr_to_block (pblock, tmp);
/* Add the exit label. */
tmp = build1_v (LABEL_EXPR, exit_label);
gfc_add_expr_to_block (pblock, tmp);
-
- /* Restore the original value of the loop counter. */
- gfc_add_modify_expr (pblock, loopvar, tmp_loopvar);
}
}
mpz_clear (size);
}
But something is still using the wrong 'i':
<D.937>:;
if (i.4D.918 > D.919)
{
goto L.1D.922;
}
else
{
}
D.932 = atmp.2D.915.dataD.906;
D.938 = (integer(kind=4)D.8[0] *) D.932;
offset.6D.939 = offset.3D.917;
(*D.938)[offset.6D.939] = iD.902; <<===== This is the wrong "i"!!
offset.3D.917 = offset.3D.917 + 1;
i.4D.918 = i.4D.918 + 1;
goto <D.937>;
I also give up. Too time-consuming understanding what is going on...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29458
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug fortran/29458] Spurious -Wuninitialized warning for implied do-loop counter
2006-10-13 14:03 [Bug fortran/29458] New: Spurious -Wuninitialized warning for implied do-loop counter fxcoudert at gcc dot gnu dot org
` (13 preceding siblings ...)
2008-01-30 20:28 ` manu at gcc dot gnu dot org
@ 2009-04-05 13:20 ` dfranke at gcc dot gnu dot org
2009-04-05 18:02 ` dfranke at gcc dot gnu dot org
2009-04-05 18:04 ` dfranke at gcc dot gnu dot org
16 siblings, 0 replies; 18+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-04-05 13:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from dfranke at gcc dot gnu dot org 2009-04-05 13:20 -------
Patch:
http://gcc.gnu.org/ml/fortran/2009-04/msg00035.html
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |dfranke at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2007-08-06 13:47:12 |2009-04-05 13:20:02
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29458
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug fortran/29458] Spurious -Wuninitialized warning for implied do-loop counter
2006-10-13 14:03 [Bug fortran/29458] New: Spurious -Wuninitialized warning for implied do-loop counter fxcoudert at gcc dot gnu dot org
` (14 preceding siblings ...)
2009-04-05 13:20 ` dfranke at gcc dot gnu dot org
@ 2009-04-05 18:02 ` dfranke at gcc dot gnu dot org
2009-04-05 18:04 ` dfranke at gcc dot gnu dot org
16 siblings, 0 replies; 18+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-04-05 18:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from dfranke at gcc dot gnu dot org 2009-04-05 18:02 -------
Subject: Bug 29458
Author: dfranke
Date: Sun Apr 5 18:02:00 2009
New Revision: 145564
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145564
Log:
gcc/fortran/:
2009-04-05 Daniel Franke <franke.daniel@gmail.com>
PR fortran/29458
* trans-array.c (gfc_trans_array_constructor_value): Shadow implied
do-loop variable to avoid spurious middle-end warnings.
gcc/testsuite/:
2009-04-05 Daniel Franke <franke.daniel@gmail.com>
PR fortran/29458
* gfortran.dg/implied_do_1.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/implied_do_1.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-array.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29458
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug fortran/29458] Spurious -Wuninitialized warning for implied do-loop counter
2006-10-13 14:03 [Bug fortran/29458] New: Spurious -Wuninitialized warning for implied do-loop counter fxcoudert at gcc dot gnu dot org
` (15 preceding siblings ...)
2009-04-05 18:02 ` dfranke at gcc dot gnu dot org
@ 2009-04-05 18:04 ` dfranke at gcc dot gnu dot org
16 siblings, 0 replies; 18+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-04-05 18:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from dfranke at gcc dot gnu dot org 2009-04-05 18:04 -------
Fixed in trunk. Backport unlikely as it's not a regression. Closing.
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29458
^ permalink raw reply [flat|nested] 18+ messages in thread