[Bug c++/14481] strange warning when assigning to bitfield

arnej at europe dot yahoo-inc dot com gcc-bugzilla@gcc.gnu.org
Mon Mar 8 14:17:00 GMT 2004


------- Additional Comments From arnej at europe dot yahoo-inc dot com  2004-03-08 14:17 -------
The following program:

void func()
{
        struct mybitfields {
                unsigned int s_field:8;
        };
        struct mybitfields s;
        s.s_field = 255;
};

For some reason produces this strange warning:

bf.cpp: In function `void func()':
bf.cpp:7: warning: right-hand operand of comma has no effect

with gcc version 3.4.0 20040303 (prerelease)

Full gcc -v output:

Reading specs from /snapshot/lib/gcc/i386-unknown-freebsd4.9/3.4.0/specs
Configured with: ./configure --prefix=/snapshot
Thread model: posix
gcc version 3.4.0 20040303 (prerelease)
 /snapshot/libexec/gcc/i386-unknown-freebsd4.9/3.4.0/cc1plus -E -quiet -v bf.cpp 
-Wall -o bf.ii
ignoring nonexistent directory "/snapshot/lib/gcc/i386-unknown-freebsd4.9/3.4.
0/../../../../i386-unknown-freebsd4.9/include"
#include "..." search starts here:
#include <...> search starts here:
 /snapshot/lib/gcc/i386-unknown-freebsd4.9/3.4.0/../../../../include/c++/3.4.0
 /snapshot/lib/gcc/i386-unknown-freebsd4.9/3.4.0/../../../../include/c++/3.4.
0/i386-unknown-freebsd4.9
 /snapshot/lib/gcc/i386-unknown-freebsd4.9/3.4.0/../../../../include/c++/3.4.
0/backward
 /usr/local/include
 /snapshot/include
 /snapshot/lib/gcc/i386-unknown-freebsd4.9/3.4.0/include
 /usr/include
End of search list.
 /snapshot/libexec/gcc/i386-unknown-freebsd4.9/3.4.0/cc1plus -fpreprocessed bf.
ii -quiet -dumpbase bf.cpp -auxbase bf -Wall -version -o bf.s
GNU C++ version 3.4.0 20040303 (prerelease) (i386-unknown-freebsd4.9)
        compiled by GNU C version 2.95.4 20020320 [FreeBSD].
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=130534
bf.cpp: In function `void func()':
bf.cpp:7: warning: right-hand operand of comma has no effect
 as -o bf.o bf.s



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14481



More information about the Gcc-bugs mailing list