* [Bug fortran/40206] [gfortran] Incorrect warning with -Wuninitialized
2009-05-20 12:25 [Bug fortran/40206] New: [gfortran] Incorrect warning with -Wuninitialized martin at mpa-garching dot mpg dot de
@ 2009-05-20 12:43 ` burnus at gcc dot gnu dot org
2009-05-20 12:49 ` dfranke at gcc dot gnu dot org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-05-20 12:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from burnus at gcc dot gnu dot org 2009-05-20 12:43 -------
The dump is the following. gfortran_select_string returns only 0, 1, or 2, but
the middle end does not know this.
Manuel, do you have an idea how to solve this?
case_num.1 = _gfortran_select_string ((void *) &jumptable.0, 3, char, 1);
switch (case_num.1)
{
case 1 ... 1:;
case 2 ... 2:;
__result_char2type = 1;
goto L.1;
case 0 ... 0:;
__result_char2type = -1234;
goto L.1;
}
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu dot org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
GCC build triplet|i686-pc-linux-gnu |
GCC host triplet|i686-pc-linux-gnu |
GCC target triplet|i686-pc-linux-gnu |
Last reconfirmed|0000-00-00 00:00:00 |2009-05-20 12:43:26
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40206
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/40206] [gfortran] Incorrect warning with -Wuninitialized
2009-05-20 12:25 [Bug fortran/40206] New: [gfortran] Incorrect warning with -Wuninitialized martin at mpa-garching dot mpg dot de
2009-05-20 12:43 ` [Bug fortran/40206] " burnus at gcc dot gnu dot org
@ 2009-05-20 12:49 ` dfranke at gcc dot gnu dot org
2009-05-20 13:04 ` martin at mpa-garching dot mpg dot de
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-05-20 12:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from dfranke at gcc dot gnu dot org 2009-05-20 12:48 -------
I'd suspect this to be a related to Jakub's recent changes applied for PR39666
(i.e. r147136)? Does your testcase work for r147135?
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dfranke at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40206
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/40206] [gfortran] Incorrect warning with -Wuninitialized
2009-05-20 12:25 [Bug fortran/40206] New: [gfortran] Incorrect warning with -Wuninitialized martin at mpa-garching dot mpg dot de
2009-05-20 12:43 ` [Bug fortran/40206] " burnus at gcc dot gnu dot org
2009-05-20 12:49 ` dfranke at gcc dot gnu dot org
@ 2009-05-20 13:04 ` martin at mpa-garching dot mpg dot de
2009-05-20 13:13 ` manu at gcc dot gnu dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: martin at mpa-garching dot mpg dot de @ 2009-05-20 13:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from martin at mpa-garching dot mpg dot de 2009-05-20 13:03 -------
(In reply to comment #2)
> I'd suspect this to be a related to Jakub's recent changes applied for PR39666
> (i.e. r147136)? Does your testcase work for r147135?
I cannot check this quickly. However I tried with gfortran 4.2.3 and the head
of the 4.4 branch and got similar warnings. Surprisingly, these compilers warn
about
line 22 (instead of 23), which is still wrong...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40206
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/40206] [gfortran] Incorrect warning with -Wuninitialized
2009-05-20 12:25 [Bug fortran/40206] New: [gfortran] Incorrect warning with -Wuninitialized martin at mpa-garching dot mpg dot de
` (2 preceding siblings ...)
2009-05-20 13:04 ` martin at mpa-garching dot mpg dot de
@ 2009-05-20 13:13 ` manu at gcc dot gnu dot org
2009-05-20 13:41 ` burnus at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-05-20 13:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from manu at gcc dot gnu dot org 2009-05-20 13:12 -------
(In reply to comment #2)
> I'd suspect this to be a related to Jakub's recent changes applied for PR39666
> (i.e. r147136)? Does your testcase work for r147135?
>
On the contrary, I think this is a missed testcase from Jakub's changes,
because the default label is added during gimplification. Perhaps the patch of
Jakub can be extended to handle this, or the fortran FE can add the default
label in the correct place.
In addition, why gfortran does not name the variable char2type? Can you access
that variable when debugging?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40206
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/40206] [gfortran] Incorrect warning with -Wuninitialized
2009-05-20 12:25 [Bug fortran/40206] New: [gfortran] Incorrect warning with -Wuninitialized martin at mpa-garching dot mpg dot de
` (3 preceding siblings ...)
2009-05-20 13:13 ` manu at gcc dot gnu dot org
@ 2009-05-20 13:41 ` burnus at gcc dot gnu dot org
2009-05-20 14:14 ` rguenth at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-05-20 13:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from burnus at gcc dot gnu dot org 2009-05-20 13:40 -------
switch (case_num.1)
{
case 1 ... 1:;
case 2 ... 2:;
__result_char2type = 1;
goto L.1;
case 0 ... 0:;
__result_char2type = -1234;
goto L.1;
}
Wouldn't this solved by adding a "default:" as C does for "default:" ?
> In addition, why gfortran does not name the variable char2type?
Good question. it clashes with the name of the function, but I don't know
whether that is a problem or not. In any case: you are right, it makes
debugging harder ...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40206
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/40206] [gfortran] Incorrect warning with -Wuninitialized
2009-05-20 12:25 [Bug fortran/40206] New: [gfortran] Incorrect warning with -Wuninitialized martin at mpa-garching dot mpg dot de
` (4 preceding siblings ...)
2009-05-20 13:41 ` burnus at gcc dot gnu dot org
@ 2009-05-20 14:14 ` rguenth at gcc dot gnu dot org
2009-05-20 14:32 ` jakub at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-05-20 14:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from rguenth at gcc dot gnu dot org 2009-05-20 14:14 -------
The FE should use a default label for the last case in the switch stmt.
I also think the FE does premature optimization here, but ...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40206
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/40206] [gfortran] Incorrect warning with -Wuninitialized
2009-05-20 12:25 [Bug fortran/40206] New: [gfortran] Incorrect warning with -Wuninitialized martin at mpa-garching dot mpg dot de
` (5 preceding siblings ...)
2009-05-20 14:14 ` rguenth at gcc dot gnu dot org
@ 2009-05-20 14:32 ` jakub at gcc dot gnu dot org
2010-07-15 7:53 ` jakub at gcc dot gnu dot org
2010-07-15 15:10 ` jakub at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-05-20 14:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jakub at gcc dot gnu dot org 2009-05-20 14:32 -------
For all involved strings being non-array CHAR with length 1 I fail to see why
normal SWITCH_EXPR isn't used instead (though that would just be an
optimization).
The middle-end can't know the _gfortran_select_string function will never
return numbers bigger than the size of the jump table it is called with, so the
Fortran FE should help it. If the table contains a default label, it should
use a default: case label instead of corresponding number, and if there is no
case label, but all possible strings are covered, it can pick a random case
label as the default.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40206
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/40206] [gfortran] Incorrect warning with -Wuninitialized
2009-05-20 12:25 [Bug fortran/40206] New: [gfortran] Incorrect warning with -Wuninitialized martin at mpa-garching dot mpg dot de
` (6 preceding siblings ...)
2009-05-20 14:32 ` jakub at gcc dot gnu dot org
@ 2010-07-15 7:53 ` jakub at gcc dot gnu dot org
2010-07-15 15:10 ` jakub at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-15 7:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from jakub at gcc dot gnu dot org 2010-07-15 07:53 -------
Subject: Bug 40206
Author: jakub
Date: Thu Jul 15 07:52:51 2010
New Revision: 162209
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162209
Log:
PR fortran/40206
* trans-stmt.c (gfc_trans_character_select): Always use NULL for high
in CASE_LABEL_EXPR and use NULL for low for the default case.
* gfortran.dg/select_char_3.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/select_char_3.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-stmt.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40206
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/40206] [gfortran] Incorrect warning with -Wuninitialized
2009-05-20 12:25 [Bug fortran/40206] New: [gfortran] Incorrect warning with -Wuninitialized martin at mpa-garching dot mpg dot de
` (7 preceding siblings ...)
2010-07-15 7:53 ` jakub at gcc dot gnu dot org
@ 2010-07-15 15:10 ` jakub at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-15 15:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jakub at gcc dot gnu dot org 2010-07-15 15:09 -------
Should be fixed now for 4.6+.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40206
^ permalink raw reply [flat|nested] 10+ messages in thread