public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/18715] New: warning: "enumeration value not handled in switch" for '...' ranges
@ 2004-11-29 11:58 fork0 at users dot sf dot net
2004-11-29 12:52 ` [Bug c/18715] [4.0 Regression] " pinskia at gcc dot gnu dot org
` (13 more replies)
0 siblings, 14 replies; 15+ messages in thread
From: fork0 at users dot sf dot net @ 2004-11-29 11:58 UTC (permalink / raw)
To: gcc-bugs
gcc (GCC) 4.0.0 20041121 (experimental)
-Wswitch-enum generates the warning even if the range in
case expression covers all possible values of a enum.
The first value of the range (a0 in the example below)
is not listed as missing (but all others, including the
last). The generated code works properly, though.
Example:
enum a { a0, a1, a2, a3 };
int error(enum a aa)
{
switch ( aa )
{
case a0 ... a3:
return 1;
}
return 0;
}
Output:
gcc4-enum.c: In function 'error':
gcc4-enum.c:5: warning: enumeration value 'a1' not handled in switch
gcc4-enum.c:5: warning: enumeration value 'a2' not handled in switch
gcc4-enum.c:5: warning: enumeration value 'a3' not handled in switch
GCC (from gcc-4.0-20041121 snapshot) configured and compiled:
../gcc-4.0-20041121/configure --enable-threads --with-tune=pentium4
--disable-nls --enable-languages=c,c++
(removing -mtune=pentium4 didn't help)
--
Summary: warning: "enumeration value not handled in switch" for
'...' ranges
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fork0 at users dot sf dot net
CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18715
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/18715] [4.0 Regression] warning: "enumeration value not handled in switch" for '...' ranges
2004-11-29 11:58 [Bug c/18715] New: warning: "enumeration value not handled in switch" for '...' ranges fork0 at users dot sf dot net
@ 2004-11-29 12:52 ` pinskia at gcc dot gnu dot org
2004-12-14 6:02 ` pinskia at gcc dot gnu dot org
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-29 12:52 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-29 12:52 -------
: Search converges between 2004-05-11-trunk (#454) and 2004-05-14-trunk (#455).
: Search converges between 2003-10-30-ssa (#120) and 2003-10-31-ssa (#121).
Confirmed, a regression.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |diagnostic
Last reconfirmed|0000-00-00 00:00:00 |2004-11-29 12:52:13
date| |
Summary|warning: "enumeration value |[4.0 Regression] warning:
|not handled in switch" for |"enumeration value not
|'...' ranges |handled in switch" for '...'
| |ranges
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18715
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/18715] [4.0 Regression] warning: "enumeration value not handled in switch" for '...' ranges
2004-11-29 11:58 [Bug c/18715] New: warning: "enumeration value not handled in switch" for '...' ranges fork0 at users dot sf dot net
2004-11-29 12:52 ` [Bug c/18715] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2004-12-14 6:02 ` pinskia at gcc dot gnu dot org
2004-12-14 6:31 ` pinskia at gcc dot gnu dot org
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-14 6:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-14 06:01 -------
This patch caused it, the moving to the front-end must had forgot about some detail:
2003-10-30 Richard Henderson <rth@redhat.com>
* c-common.c (match_case_to_enum_1, match_case_to_enum): New.
(c_do_switch_warnings): New.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |rth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18715
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/18715] [4.0 Regression] warning: "enumeration value not handled in switch" for '...' ranges
2004-11-29 11:58 [Bug c/18715] New: warning: "enumeration value not handled in switch" for '...' ranges fork0 at users dot sf dot net
2004-11-29 12:52 ` [Bug c/18715] [4.0 Regression] " pinskia at gcc dot gnu dot org
2004-12-14 6:02 ` pinskia at gcc dot gnu dot org
@ 2004-12-14 6:31 ` pinskia at gcc dot gnu dot org
2004-12-14 14:35 ` pinskia at gcc dot gnu dot org
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-14 6:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-14 06:31 -------
Created an attachment (id=7735)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7735&action=view)
Patch which fixes the problem
I am testing this fix, I copied the code from c_add_case_label and changed it
a little bit.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pinskia at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18715
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/18715] [4.0 Regression] warning: "enumeration value not handled in switch" for '...' ranges
2004-11-29 11:58 [Bug c/18715] New: warning: "enumeration value not handled in switch" for '...' ranges fork0 at users dot sf dot net
` (2 preceding siblings ...)
2004-12-14 6:31 ` pinskia at gcc dot gnu dot org
@ 2004-12-14 14:35 ` pinskia at gcc dot gnu dot org
2005-03-20 23:34 ` [Bug c/18715] [4.0/4.1 " pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-14 14:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-14 14:34 -------
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-12/msg01028.html>.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18715
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/18715] [4.0/4.1 Regression] warning: "enumeration value not handled in switch" for '...' ranges
2004-11-29 11:58 [Bug c/18715] New: warning: "enumeration value not handled in switch" for '...' ranges fork0 at users dot sf dot net
` (3 preceding siblings ...)
2004-12-14 14:35 ` pinskia at gcc dot gnu dot org
@ 2005-03-20 23:34 ` pinskia at gcc dot gnu dot org
2005-03-30 18:09 ` jsm28 at gcc dot gnu dot org
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-20 23:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-03-20 23:34 -------
*** Bug 20571 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |ajd at gentrack dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18715
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/18715] [4.0/4.1 Regression] warning: "enumeration value not handled in switch" for '...' ranges
2004-11-29 11:58 [Bug c/18715] New: warning: "enumeration value not handled in switch" for '...' ranges fork0 at users dot sf dot net
` (4 preceding siblings ...)
2005-03-20 23:34 ` [Bug c/18715] [4.0/4.1 " pinskia at gcc dot gnu dot org
@ 2005-03-30 18:09 ` jsm28 at gcc dot gnu dot org
2005-04-05 1:42 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-03-30 18:09 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jsm28 at gcc dot gnu dot org 2005-03-30 18:09 -------
Is there a more recent patch version than that referred to in comment #4,
taking account of Mark's comments on that patch version?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18715
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/18715] [4.0/4.1 Regression] warning: "enumeration value not handled in switch" for '...' ranges
2004-11-29 11:58 [Bug c/18715] New: warning: "enumeration value not handled in switch" for '...' ranges fork0 at users dot sf dot net
` (5 preceding siblings ...)
2005-03-30 18:09 ` jsm28 at gcc dot gnu dot org
@ 2005-04-05 1:42 ` pinskia at gcc dot gnu dot org
2005-04-08 21:48 ` mmitchel at gcc dot gnu dot org
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-05 1:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-05 01:42 -------
(In reply to comment #6)
> Is there a more recent patch version than that referred to in comment #4,
> taking account of Mark's comments on that patch version?
I was talking with Roger off the list and he said Mark was wrong in that and also this code was just
copied from exactly from c_add_case_label. I am going to apply the patch as is, in the next couple
days.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18715
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/18715] [4.0/4.1 Regression] warning: "enumeration value not handled in switch" for '...' ranges
2004-11-29 11:58 [Bug c/18715] New: warning: "enumeration value not handled in switch" for '...' ranges fork0 at users dot sf dot net
` (6 preceding siblings ...)
2005-04-05 1:42 ` pinskia at gcc dot gnu dot org
@ 2005-04-08 21:48 ` mmitchel at gcc dot gnu dot org
2005-04-21 4:57 ` mmitchel at gcc dot gnu dot org
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-04-08 21:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mmitchel at gcc dot gnu dot org 2005-04-08 21:48 -------
Removing rejects-valid; treating all incorrect warnings as rejects-valid due to
-Werror is not useful.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords|rejects-valid |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18715
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/18715] [4.0/4.1 Regression] warning: "enumeration value not handled in switch" for '...' ranges
2004-11-29 11:58 [Bug c/18715] New: warning: "enumeration value not handled in switch" for '...' ranges fork0 at users dot sf dot net
` (7 preceding siblings ...)
2005-04-08 21:48 ` mmitchel at gcc dot gnu dot org
@ 2005-04-21 4:57 ` mmitchel at gcc dot gnu dot org
2005-07-08 1:34 ` mmitchel at gcc dot gnu dot org
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-04-21 4:57 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.0.0 |4.0.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18715
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/18715] [4.0/4.1 Regression] warning: "enumeration value not handled in switch" for '...' ranges
2004-11-29 11:58 [Bug c/18715] New: warning: "enumeration value not handled in switch" for '...' ranges fork0 at users dot sf dot net
` (8 preceding siblings ...)
2005-04-21 4:57 ` mmitchel at gcc dot gnu dot org
@ 2005-07-08 1:34 ` mmitchel at gcc dot gnu dot org
2005-08-22 16:24 ` cvs-commit at gcc dot gnu dot org
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-07-08 1:34 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.0.1 |4.0.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18715
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/18715] [4.0/4.1 Regression] warning: "enumeration value not handled in switch" for '...' ranges
2004-11-29 11:58 [Bug c/18715] New: warning: "enumeration value not handled in switch" for '...' ranges fork0 at users dot sf dot net
` (9 preceding siblings ...)
2005-07-08 1:34 ` mmitchel at gcc dot gnu dot org
@ 2005-08-22 16:24 ` cvs-commit at gcc dot gnu dot org
2005-08-22 16:28 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-22 16:24 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-08-22 16:21 -------
Subject: Bug 18715
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: pinskia@gcc.gnu.org 2005-08-22 16:21:19
Modified files:
gcc : ChangeLog c-common.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/gcc.dg: switch-warn-3.c
Log message:
2005-08-22 Andrew Pinski <pinskia@physics.uc.edu>
PR c/18715
* c-common.c (c_do_switch_warnings): Look for a node where the enum's
value is inbetween the range if we did not find an exact match.
2005-08-22 Andrew Pinski <pinskia@physics.uc.edu>
PR c/18175
* gcc.dg/switch-warn-3.c: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9798&r2=2.9799
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&r1=1.649&r2=1.650
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5947&r2=1.5948
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/switch-warn-3.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18715
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/18715] [4.0/4.1 Regression] warning: "enumeration value not handled in switch" for '...' ranges
2004-11-29 11:58 [Bug c/18715] New: warning: "enumeration value not handled in switch" for '...' ranges fork0 at users dot sf dot net
` (10 preceding siblings ...)
2005-08-22 16:24 ` cvs-commit at gcc dot gnu dot org
@ 2005-08-22 16:28 ` cvs-commit at gcc dot gnu dot org
2005-08-22 16:29 ` pinskia at gcc dot gnu dot org
2005-08-22 16:31 ` cvs-commit at gcc dot gnu dot org
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-22 16:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-08-22 16:26 -------
Subject: Bug 18715
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: pinskia@gcc.gnu.org 2005-08-22 16:26:06
Modified files:
gcc/testsuite : ChangeLog
Log message:
Fix PR number in changelog:
2005-08-22 Andrew Pinski <pinskia@physics.uc.edu>
PR c/18715
* gcc.dg/switch-warn-3.c: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5948&r2=1.5949
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18715
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/18715] [4.0/4.1 Regression] warning: "enumeration value not handled in switch" for '...' ranges
2004-11-29 11:58 [Bug c/18715] New: warning: "enumeration value not handled in switch" for '...' ranges fork0 at users dot sf dot net
` (11 preceding siblings ...)
2005-08-22 16:28 ` cvs-commit at gcc dot gnu dot org
@ 2005-08-22 16:29 ` pinskia at gcc dot gnu dot org
2005-08-22 16:31 ` cvs-commit at gcc dot gnu dot org
13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-22 16:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-22 16:28 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18715
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/18715] [4.0/4.1 Regression] warning: "enumeration value not handled in switch" for '...' ranges
2004-11-29 11:58 [Bug c/18715] New: warning: "enumeration value not handled in switch" for '...' ranges fork0 at users dot sf dot net
` (12 preceding siblings ...)
2005-08-22 16:29 ` pinskia at gcc dot gnu dot org
@ 2005-08-22 16:31 ` cvs-commit at gcc dot gnu dot org
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-22 16:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-08-22 16:29 -------
Subject: Bug 18715
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-4_0-branch
Changes by: pinskia@gcc.gnu.org 2005-08-22 16:29:02
Modified files:
gcc : ChangeLog c-common.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/gcc.dg: switch-warn-3.c
Log message:
2005-08-22 Andrew Pinski <pinskia@physics.uc.edu>
PR c/18715
* c-common.c (c_do_switch_warnings): Look for a node where the enum's
value is inbetween the range if we did not find an exact match.
2005-08-22 Andrew Pinski <pinskia@physics.uc.edu>
PR c/18715
* gcc.dg/switch-warn-3.c: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.381&r2=2.7592.2.382
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.606.2.6&r2=1.606.2.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.344&r2=1.5084.2.345
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/switch-warn-3.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18715
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2005-08-22 16:29 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-29 11:58 [Bug c/18715] New: warning: "enumeration value not handled in switch" for '...' ranges fork0 at users dot sf dot net
2004-11-29 12:52 ` [Bug c/18715] [4.0 Regression] " pinskia at gcc dot gnu dot org
2004-12-14 6:02 ` pinskia at gcc dot gnu dot org
2004-12-14 6:31 ` pinskia at gcc dot gnu dot org
2004-12-14 14:35 ` pinskia at gcc dot gnu dot org
2005-03-20 23:34 ` [Bug c/18715] [4.0/4.1 " pinskia at gcc dot gnu dot org
2005-03-30 18:09 ` jsm28 at gcc dot gnu dot org
2005-04-05 1:42 ` pinskia at gcc dot gnu dot org
2005-04-08 21:48 ` mmitchel at gcc dot gnu dot org
2005-04-21 4:57 ` mmitchel at gcc dot gnu dot org
2005-07-08 1:34 ` mmitchel at gcc dot gnu dot org
2005-08-22 16:24 ` cvs-commit at gcc dot gnu dot org
2005-08-22 16:28 ` cvs-commit at gcc dot gnu dot org
2005-08-22 16:29 ` pinskia at gcc dot gnu dot org
2005-08-22 16:31 ` cvs-commit at gcc dot gnu dot org
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).