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

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).