This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c/10040: Incorrect warning message for bit fields


On 12 Mar 2003 peterson at austin dot ibm dot 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]