public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/61405] New: Not emitting "enumeration value not handled in switch" warning for bit-field enums
@ 2014-06-03 16:09 jamborm at gcc dot gnu.org
2014-06-03 16:12 ` [Bug c/61405] " jamborm at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: jamborm at gcc dot gnu.org @ 2014-06-03 16:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61405
Bug ID: 61405
Summary: Not emitting "enumeration value not handled in switch"
warning for bit-field enums
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: jamborm at gcc dot gnu.org
This a followup to PR 61340. In both C and C++ we do not emit a
warning about unhandled enumeration values in a switch if the enum is
also a bit-field (and clang does, that is how it was noticed).
Testcase:
$ cat test.c
enum ipa_ref_use
{
IPA_REF_LOAD,
IPA_REF_STORE,
IPA_REF_ADDR,
IPA_REF_ALIAS
};
/* Record of reference in callgraph or varpool. */
struct ipa_ref
{
unsigned int lto_stmt_uid;
unsigned int referred_index;
#ifndef PRODUCE_WARNING
enum ipa_ref_use use:2;
#else
enum ipa_ref_use use;
#endif
unsigned int speculative:1;
};
int blah1 (unsigned int);
int blah2 (unsigned int);
int blah3 (unsigned int);
int
foo (struct ipa_ref *ref)
{
int r;
switch (ref->use)
{
case IPA_REF_LOAD:
r = blah1 (ref->lto_stmt_uid) + 8;
break;
case IPA_REF_STORE:
r = blah2 (ref->referred_index +5) * 3;
break;
case IPA_REF_ADDR:
r = blah3 (ref->lto_stmt_uid + ref->speculative);
break;
}
return r;
}
$ ~/gcc/mine/inst/bin/gcc test.c -O -S -Wswitch
$ ~/gcc/mine/inst/bin/gcc test.c -O -S -Wswitch -DPRODUCE_WARNING
test.c: In function ‘foo’:
test.c:30:3: warning: enumeration value ‘IPA_REF_ALIAS’ not handled in switch
[-Wswitch]
switch (ref->use)
^
$ clang test.c -O -S -Wswitch -DPRODUCE_WARNING
test.c:30:11: warning: enumeration value 'IPA_REF_ALIAS' not handled in switch
[-Wswitch]
switch (ref->use)
^
1 warning generated.
>From gcc-bugs-return-453107-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jun 03 16:10:45 2014
Return-Path: <gcc-bugs-return-453107-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 491 invoked by alias); 3 Jun 2014 16:10:45 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 400 invoked by uid 48); 3 Jun 2014 16:10:42 -0000
From: "christophe.lyon at st dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/61154] [4.10 Regression][ARM] wide-int merge introduced regressions in vshuf tests
Date: Tue, 03 Jun 2014 16:10:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.10.0
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: christophe.lyon at st dot com
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: ramana at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.10.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-61154-4-WtZBW07Jky@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61154-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61154-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-06/txt/msg00189.txt.bz2
Content-length: 162
https://gcc.gnu.org/bugzilla/show_bug.cgi?ida154
--- Comment #9 from christophe.lyon at st dot com ---
I confirm it fixes the regressions I reported.
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/61405] Not emitting "enumeration value not handled in switch" warning for bit-field enums
2014-06-03 16:09 [Bug c/61405] New: Not emitting "enumeration value not handled in switch" warning for bit-field enums jamborm at gcc dot gnu.org
@ 2014-06-03 16:12 ` jamborm at gcc dot gnu.org
2014-06-03 16:25 ` manu at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jamborm at gcc dot gnu.org @ 2014-06-03 16:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61405
--- Comment #1 from Martin Jambor <jamborm at gcc dot gnu.org> ---
The reason why we do not emit is that in c_do_switch_warnings in
c-family/c-common.c we check that:
/* From here on, we only care about about enumerated types. */
if (!type || TREE_CODE (type) != ENUMERAL_TYPE)
return;
which fails because (unlike in the non-bit-field case) type is:
<integer_type 0x7ffff6d5e150 public unsigned QI
size <integer_cst 0x7ffff6c34768 type <integer_type 0x7ffff6c36150
bitsizetype> constant 8>
unit size <integer_cst 0x7ffff6c34780 type <integer_type 0x7ffff6c360a8
sizetype> constant 1>
align 8 symtab 0 alias set -1 canonical type 0x7ffff6d5e150 precision 2 min
<integer_cst 0x7ffff6d4adc8 0> max <integer_cst 0x7ffff6d4ade0 3>>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/61405] Not emitting "enumeration value not handled in switch" warning for bit-field enums
2014-06-03 16:09 [Bug c/61405] New: Not emitting "enumeration value not handled in switch" warning for bit-field enums jamborm at gcc dot gnu.org
2014-06-03 16:12 ` [Bug c/61405] " jamborm at gcc dot gnu.org
@ 2014-06-03 16:25 ` manu at gcc dot gnu.org
2014-09-18 9:02 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu.org @ 2014-06-03 16:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61405
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu.org
--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
*** Bug 61344 has been marked as a duplicate of this bug. ***
>From gcc-bugs-return-453113-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jun 03 16:25:41 2014
Return-Path: <gcc-bugs-return-453113-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 24744 invoked by alias); 3 Jun 2014 16:25:41 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 24676 invoked by uid 48); 3 Jun 2014 16:25:37 -0000
From: "iains at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/61396] [4.10 regression] ICE in simplify_immed_subreg
Date: Tue, 03 Jun 2014 16:25:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.10.0
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: iains at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.10.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on cc everconfirmed
Message-ID: <bug-61396-4-eyMPKQanEt@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61396-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61396-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-06/txt/msg00195.txt.bz2
Content-length: 561
https://gcc.gnu.org/bugzilla/show_bug.cgi?ida396
Iain Sandoe <iains at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-06-03
CC| |iains at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Iain Sandoe <iains at gcc dot gnu.org> ---
confirmed on ppc-darwin9
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/61405] Not emitting "enumeration value not handled in switch" warning for bit-field enums
2014-06-03 16:09 [Bug c/61405] New: Not emitting "enumeration value not handled in switch" warning for bit-field enums jamborm at gcc dot gnu.org
2014-06-03 16:12 ` [Bug c/61405] " jamborm at gcc dot gnu.org
2014-06-03 16:25 ` manu at gcc dot gnu.org
@ 2014-09-18 9:02 ` mpolacek at gcc dot gnu.org
2014-09-18 9:11 ` mpolacek at gcc dot gnu.org
2014-09-24 17:25 ` mpolacek at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-09-18 9:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61405
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |mpolacek at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
Target Milestone|--- |5.0
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I'll give this a try.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/61405] Not emitting "enumeration value not handled in switch" warning for bit-field enums
2014-06-03 16:09 [Bug c/61405] New: Not emitting "enumeration value not handled in switch" warning for bit-field enums jamborm at gcc dot gnu.org
` (2 preceding siblings ...)
2014-09-18 9:02 ` mpolacek at gcc dot gnu.org
@ 2014-09-18 9:11 ` mpolacek at gcc dot gnu.org
2014-09-24 17:25 ` mpolacek at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-09-18 9:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61405
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
/* PR c/61405 */
/* { dg-do compile } */
/* { dg-options "-Wswitch" } */
enum E { A, B, C };
struct S { enum E e:2; };
int
foo (struct S *s)
{
switch (s->e) /* { dg-warning "enumeration value .C. not handled in switch" }
*/
{
case A:
return 1;
case B:
return 2;
}
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/61405] Not emitting "enumeration value not handled in switch" warning for bit-field enums
2014-06-03 16:09 [Bug c/61405] New: Not emitting "enumeration value not handled in switch" warning for bit-field enums jamborm at gcc dot gnu.org
` (3 preceding siblings ...)
2014-09-18 9:11 ` mpolacek at gcc dot gnu.org
@ 2014-09-24 17:25 ` mpolacek at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-09-24 17:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61405
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-09-24 17:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-03 16:09 [Bug c/61405] New: Not emitting "enumeration value not handled in switch" warning for bit-field enums jamborm at gcc dot gnu.org
2014-06-03 16:12 ` [Bug c/61405] " jamborm at gcc dot gnu.org
2014-06-03 16:25 ` manu at gcc dot gnu.org
2014-09-18 9:02 ` mpolacek at gcc dot gnu.org
2014-09-18 9:11 ` mpolacek at gcc dot gnu.org
2014-09-24 17:25 ` mpolacek at gcc dot gnu.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).