From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30593 invoked by alias); 12 Mar 2003 16:46:00 -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 30574 invoked by uid 71); 12 Mar 2003 16:46:00 -0000 Date: Wed, 12 Mar 2003 16:46:00 -0000 Message-ID: <20030312164600.30564.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Falk Hueffner Subject: Re: c/10040: Incorrect warning message for bit fields Reply-To: Falk Hueffner X-SW-Source: 2003-03/txt/msg00696.txt.bz2 List-Id: The following reply was made to PR c/10040; it has been noted by GNATS. From: Falk Hueffner To: Cc: , , Subject: Re: c/10040: Incorrect warning message for bit fields Date: Wed, 12 Mar 2003 17:40:27 +0100 (CET) On 12 Mar 2003 peterson@austin.ibm.com wrote: > int _v: 1; > if ((*tlb)._hi._v == 1) > > warning: comparison is always 0 due to width of bit-field The warning seems 100% correct to me. The comparison *is* always 0. > In trying to explain the problem, I'm beginning to see that this error > message is a result of the bit field being an "int" (signed) rather > than "unsigned int". In which case, maybe the problem is best > addressed by a different warning message -- "bit field too small for > value and sign bit; consider unsigned type for field" That's too much guessing for my taste. The declaration might be just what was intended, and only the comparison is bogus. At most I'd consider "warning: comparison is always 0 due to width and signedness of bit-field". Falk