http://llvm.org/bugs/show_bug.cgi?id=21158
Bug ID: 21158
Summary: unsafe mix of type 'bool' and type 'unsigned __int64'
in DebugInfo & StringRef
Product: new-bugs
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
With trunk r219051 Visual C++ warns:
C:\llvm-clean\include\llvm/ADT/StringRef.h(351): warning C4805: '!=' : unsafe
mix of type 'bool' and type 'unsigned __int64' in operation
(..\..\..\lib\Analysis\ModuleDebugInfoPrinter.cpp)
[C:\llvm-clean\msvc\lib\Analysis\LLVMAnalysis.vcxproj]
C:\llvm-clean\include\llvm/IR/DebugInfo.h(200) : see reference to
function template instantiation 'bool llvm::Stri
ngRef::getAsInteger<T>(unsigned int,T &) const' being compiled
with
[
T=bool
]
C:\llvm-clean\include\llvm/IR/DebugInfo.h(554) : see reference to
function template instantiation 'T llvm::DIDescr
iptor::getHeaderFieldAs<bool>(unsigned int) const' being compiled
with
[
T=bool
]
the warning may have merit, when getHeaderFieldAs<bool> instantiates
getAsInteger with T=bool ,the comparison logic
static_cast<T>(ULLVal) != ULLVal)
which for integers checks if the ULLVal fits in a T sized integer will work
somewhat differently for a bool. It will check if ULLVal was 0 or 1 and if not
return an error code. This in incosistent with the usual C++ assumption that
any non-zero is true.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs