From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6439 invoked by alias); 24 Jan 2002 19:56:04 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 6402 invoked by uid 71); 24 Jan 2002 19:56:02 -0000 Resent-Date: 24 Jan 2002 19:56:02 -0000 Resent-Message-ID: <20020124195602.6401.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, olsenc@ichips.intel.com Received:(qmail 30802 invoked from network); 24 Jan 2002 19:45:55 -0000 Received: from unknown (HELO ganymede.or.intel.com) (134.134.248.3) by sources.redhat.com with SMTP; 24 Jan 2002 19:45:55 -0000 Received: from ptdcs2.intel.com (ptdcs2.ra.intel.com [137.102.168.28]) by ganymede.or.intel.com (8.9.1a+p1/8.9.1/d: relay.m4,v 1.48 2001/12/13 16:27:50 root Exp $) with ESMTP id TAA25804 for ; Thu, 24 Jan 2002 19:45:54 GMT Received: from ptdl125.ra.intel.com (ptdl125.ra.intel.com [137.102.165.171]) by ptdcs2.intel.com (8.11.4/8.11.4) with ESMTP id g0OJjs729424; Thu, 24 Jan 2002 11:45:54 -0800 (PST) Received: (from olsenc@localhost) by ptdl125.ra.intel.com (8.9.3/8.9.3) id LAA17459; Thu, 24 Jan 2002 11:45:54 -0800 Message-Id:<200201241945.LAA17459@ptdl125.ra.intel.com> Date: Thu, 24 Jan 2002 11:56:00 -0000 From: olsenc@ichips.intel.com To: gcc-gnats@gcc.gnu.org Cc: ewallace@ichips.intel.com X-Send-Pr-Version:3.113 Subject: c/5480: -Wall doesn't issue warning for enumerated type mismatch X-SW-Source: 2002-01/txt/msg00871.txt.bz2 List-Id: >Number: 5480 >Category: c >Synopsis: -Wall doesn't issue warning for enumerated type mismatch >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: change-request >Submitter-Id: net >Arrival-Date: Thu Jan 24 11:56:00 PST 2002 >Closed-Date: >Last-Modified: >Originator: >Release: 3.0.2 >Organization: >Environment: System: Linux ptdl125 2.2.19-6smp-ltd3 #2 SMP Thu Jun 7 19:50:16 PDT 2001 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ../gcc-3.0.2/configure --prefix=/usr/intel/pkgs/gcc/3.0.2 --enable-shared --with-gnu-as=/usr/intel/pkgs/gcc/3.0.2/bin/gas --with-gnu-ld --with-ld=/usr/intel/pkgs/gcc/3.0.2/bin/gld >Description: Gcc -Wall doesn't issue a warning that an object declared of enumerated type is compared or assigned to a different enumerated type. If you're going to go to the trouble to ensure that all members of an enumerated type are handled in a switch block, why not cover this case? Although I marked this as non-critical, this has burned a few of us due to similar naming for enumerated type choices. >How-To-Repeat: typedef enum { SQUARE, HEXAGON, PENTAGON } Polygon; typedef enum { CAT, DOG, AARDVARK } Animal; int main(int argc, char **argv) { Polygon foo = PENTAGON; if (foo == AARDVARK) exit(AARDVARK); else exit(0); } >Fix: I think a warning should be issued for this case. >Release-Note: >Audit-Trail: >Unformatted: