This is the mail archive of the gcc@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]

unexpected warning "comparison of promoted ~unsigned with unsigned warning"


Hello,

Consider the following test C function:

int f(void)
{
	volatile struct {
		unsigned char a;
		unsigned char b;
	} s;

	s.a = 0xbc;
	s.b = s.a ^ 0xff;

	return s.a != (s.b ^ 0xff);
}

When compiled by gcc 4.6.1 with:

gcc -c wpromoted-simple.c -Wsign-compare

I'm getting:

wpromoted-simple.c: In function 'f':
wpromoted-simple.c:11:13: warning: comparison of promoted ~unsigned with
unsigned [-Wsign-compare]

This is unexpected to me. Without the volatile, I don't get the warning.

Is this a different effect of bug #38341 ?

Thanks,
-- 
Pedro Pedruzzi


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