public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/53874] New: -Wswitch-enum not properly working with bitfields
@ 2012-07-06 13:06 jan.smets@alcatel-lucent.com
2012-07-06 13:09 ` [Bug c/53874] " jan.smets@alcatel-lucent.com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: jan.smets@alcatel-lucent.com @ 2012-07-06 13:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53874
Bug #: 53874
Summary: -Wswitch-enum not properly working with bitfields
Classification: Unclassified
Product: gcc
Version: 4.6.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jan.smets@alcatel-lucent.com
typedef enum
{
A,
B,
C
} tEnum;
typedef struct t_A
{
tEnum my_enum:4;
} tA;
int test(tA * bla)
{
switch(bla->my_enum)
{
default:
return 0;
}
}
I expect the compiler to complain:
test-enum.c:23: warning: enumeration value `A' not handled in switch
test-enum.c:23: warning: enumeration value `B' not handled in switch
test-enum.c:23: warning: enumeration value `C' not handled in switch
I verified this works in GCC 3.4 but not in GCC 4.6.
Thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/53874] -Wswitch-enum not properly working with bitfields
2012-07-06 13:06 [Bug c/53874] New: -Wswitch-enum not properly working with bitfields jan.smets@alcatel-lucent.com
@ 2012-07-06 13:09 ` jan.smets@alcatel-lucent.com
2014-05-28 19:18 ` manu at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: jan.smets@alcatel-lucent.com @ 2012-07-06 13:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53874
--- Comment #1 from Jan Smets <jan.smets@alcatel-lucent.com> 2012-07-06 13:09:29 UTC ---
And if the :4 is removed, then it works as expected.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/53874] -Wswitch-enum not properly working with bitfields
2012-07-06 13:06 [Bug c/53874] New: -Wswitch-enum not properly working with bitfields jan.smets@alcatel-lucent.com
2012-07-06 13:09 ` [Bug c/53874] " jan.smets@alcatel-lucent.com
@ 2014-05-28 19:18 ` manu at gcc dot gnu.org
2014-09-19 13:30 ` mpolacek at gcc dot gnu.org
2014-09-24 17:24 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: manu at gcc dot gnu.org @ 2014-05-28 19:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53874
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-05-28
CC| |manu at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Confirmed. Related to PR61344. Clang does print a warning:
test2.c:17:10: warning: enumeration values 'A', 'B', and 'C' not explicitly
handled in switch [-Wswitch-enum]
switch(bla->my_enum)
^
(and a better warning than gcc, printing three times the same warning is not
very nice).
>From gcc-bugs-return-452755-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed May 28 19:36:18 2014
Return-Path: <gcc-bugs-return-452755-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 8994 invoked by alias); 28 May 2014 19:36:18 -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 8941 invoked by uid 48); 28 May 2014 19:36:15 -0000
From: "carrot at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/61202] gcc generates invalid sqdmulh instruction
Date: Wed, 28 May 2014 19:36: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.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: carrot at google dot com
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status resolution
Message-ID: <bug-61202-4-JoS3ClmClV@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61202-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61202-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-05/txt/msg02447.txt.bz2
Content-length: 558
https://gcc.gnu.org/bugzilla/show_bug.cgi?ida202
Carrot <carrot at google dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Carrot <carrot at google dot com> ---
(In reply to java4ada from comment #5)
> Will this bug cover 4.8.x as well? (or file separate bug for 4.8.x)
Yes. I have committed the patch to 4.8 branch.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/53874] -Wswitch-enum not properly working with bitfields
2012-07-06 13:06 [Bug c/53874] New: -Wswitch-enum not properly working with bitfields jan.smets@alcatel-lucent.com
2012-07-06 13:09 ` [Bug c/53874] " jan.smets@alcatel-lucent.com
2014-05-28 19:18 ` manu at gcc dot gnu.org
@ 2014-09-19 13:30 ` mpolacek at gcc dot gnu.org
2014-09-24 17:24 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-09-19 13:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53874
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 #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Patch I've just posted should fix this as well.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/53874] -Wswitch-enum not properly working with bitfields
2012-07-06 13:06 [Bug c/53874] New: -Wswitch-enum not properly working with bitfields jan.smets@alcatel-lucent.com
` (2 preceding siblings ...)
2014-09-19 13:30 ` mpolacek at gcc dot gnu.org
@ 2014-09-24 17:24 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-09-24 17:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53874
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Wed Sep 24 17:23:56 2014
New Revision: 215559
URL: https://gcc.gnu.org/viewcvs?rev=215559&root=gcc&view=rev
Log:
PR c/61405
PR c/53874
gcc/
* asan.c (maybe_instrument_call): Add default case.
* ipa-pure-const.c (special_builtin_state): Likewise.
* predict.c (expr_expected_value_1): Likewise.
* lto-streamer-out.c (write_symbol): Initialize variable.
gcc/c-family/
* c-common.h (struct c_common_resword): Don't define CPP_KEYWORD.
gcc/c/
* c-parser.c: Don't define CPP_KEYWORD.
(c_parser_switch_statement): Pass original type to c_finish_case.
* c-tree.h (c_finish_case): Update declaration.
* c-typeck.c (c_finish_case): Add TYPE parameter. Pass it
conditionally to c_do_switch_warnings.
gcc/cp/
* semantics.c (finish_switch_cond): Call unlowered_expr_type.
* tree.c (bot_manip): Add default case.
* parser.c (cp_parser_primary_expression): Cast the controlling
expression of a switch to an int.
(cp_parser_unqualified_id): Likewise.
gcc/testsuite/
* c-c++-common/pr53874.c: New test.
* c-c++-common/pr61405.c: New test.
libcpp/
* include/cpplib.h (enum cpp_ttype): Define CPP_KEYWORD.
Added:
trunk/gcc/testsuite/c-c++-common/pr53874.c
trunk/gcc/testsuite/c-c++-common/pr61405.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/asan.c
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-common.h
trunk/gcc/c/ChangeLog
trunk/gcc/c/c-parser.c
trunk/gcc/c/c-tree.h
trunk/gcc/c/c-typeck.c
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/parser.c
trunk/gcc/cp/semantics.c
trunk/gcc/cp/tree.c
trunk/gcc/ipa-pure-const.c
trunk/gcc/lto-streamer-out.c
trunk/gcc/predict.c
trunk/gcc/testsuite/ChangeLog
trunk/libcpp/ChangeLog
trunk/libcpp/include/cpplib.h
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-09-24 17:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-06 13:06 [Bug c/53874] New: -Wswitch-enum not properly working with bitfields jan.smets@alcatel-lucent.com
2012-07-06 13:09 ` [Bug c/53874] " jan.smets@alcatel-lucent.com
2014-05-28 19:18 ` manu at gcc dot gnu.org
2014-09-19 13:30 ` mpolacek at gcc dot gnu.org
2014-09-24 17:24 ` 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).