This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15069] [3.4/3.5 regression] a bit test on a variable of enum type is miscompiled
- From: "roger at eyesopen dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 May 2004 22:33:07 -0000
- Subject: [Bug c++/15069] [3.4/3.5 regression] a bit test on a variable of enum type is miscompiled
- References: <20040422125216.15069.bruno@clisp.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From roger at eyesopen dot com 2004-05-28 22:33 -------
The definition of CONVERT_EXPR is that it *may* generate code to perform
the conversion. It is ultimately the middle-end that decides whether
code needs to be generated or not. However, this is a red-herring, if
you look at my patch to fold_single_bit_test, you'll notice that the
cause of the failure is unrelated to conversion operations and affects
code without NOP_EXPRs or CONVERT_EXPRs.
It's actually in the code that optimizes "((unsigned char)C & 128) != 0"
into "(char)C < 0"! When C is a bit-field enumeration, creating a signed
type, returns a type of a different width. Doh!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15069