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

[Bug c++/15069] [3.4/3.5 regression] a bit test on a variable of enum type is miscompiled


------- 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


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