[LLVMbugs] [Bug 9000] New: enums are classified as unsigned ints instead of signed ones
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Jan 18 09:41:18 PST 2011
http://llvm.org/bugs/show_bug.cgi?id=9000
Summary: enums are classified as unsigned ints instead of
signed ones
Product: clang
Version: unspecified
Platform: PC
OS/Version: FreeBSD
Status: NEW
Severity: normal
Priority: P
Component: Frontend
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: rdivacky at freebsd.org
CC: llvmbugs at cs.uiuc.edu
typedef enum {
X,
Y
} foo;
int main(int argc, char **argv) {
foo z;
return (z >= 0);
}
the LHS of (z >= 0) is
(gdb) p E->getLHS()->dump()
(ImplicitCastExpr 0x801897ee0 'unsigned int' <IntegralCast>
(ImplicitCastExpr 0x801897ec0 'foo':'foo' <LValueToRValue>
(DeclRefExpr 0x801897e60 'foo':'foo' lvalue Var='z' 0x801897df0)))
cast to "unsigned int" is wrong in my opinion. it should be "int". this has the
side effect of this bogus warning:
enum.c:9:13: warning: comparison of unsigned enum expression >= 0 is always
true
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list