glibc 2.2, libstdc++-v3 and -Werror
H . J . Lu
hjl@valinux.com
Sat Jul 1 21:15:00 GMT 2000
This is a code segment from glibc 2.2. gcc 2.96 gives:
# gcc -S x.cc
x.cc: In function `long unsigned int foo ()':
x.cc:4: warning: left shift count is negative
x.cc:4: warning: left shift count is negative
But libstdc++-v3 uses -Werror. I cannot compile libstdc++-v3 under
glibc 2.2 because of it. I don't know if gcc should warn the
unreachable code. It is a useless warning.
BTW, the code is taken from a macro expansion.
--
H.J. Lu (hjl@gnu.org)
--
unsigned long
foo ()
{
return ((0) < 8 ? (int) (1UL << ((0) + 24)) : ((0) < 16 ? (int) (1UL << ((0) + 8)) : ((0) < 24 ? (int) (1UL << ((0) - 8 )) : (int) (1UL << ((0) - 24)))));
}
More information about the Gcc-bugs
mailing list