spurious warning on increment of bitfield

Ian Young iay@3L.co.uk
Thu Mar 16 05:02:00 GMT 2000


Solaris 2.6, GCC 2.95.2

y.cpp:

   struct proc {
      unsigned c: 16;
   };

   void f(struct proc *p)
   {
      p->c++;
   }

% g++ -c -Wall y.cpp
y.cpp: in function `void f(proc *)':
y.cpp:7: warning: value computed is not used

The warning does not occur if, for example, c is defined as an unsigned
short.

	-- Ian


More information about the Gcc-bugs mailing list