[Bug 52263] New: cli-wrapper-mpxtable.cpp - suspicious always true comparison

Bug ID 52263
Summary cli-wrapper-mpxtable.cpp - suspicious always true comparison
Product lldb
Version unspecified
Hardware PC
OS Windows NT
Status NEW
Severity enhancement
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter llvm-dev@redking.me.uk
CC jdevlieghere@apple.com, llvm-bugs@lists.llvm.org

static void PrintBTEntry(lldb::addr_t lbound, lldb::addr_t ubound,
                         uint64_t value, uint64_t meta,
                         lldb::SBCommandReturnObject &result) {
  const lldb::addr_t one_cmpl64 = ~((lldb::addr_t)0);
  const lldb::addr_t one_cmpl32 = ~((uint32_t)0);

  if ((lbound == one_cmpl64 || one_cmpl32) && ubound == 0) {
    result.Printf("Null bounds on map: pointer value = 0x%" PRIu64 "\n",
value);
  } else {
    result.Printf("    lbound = 0x%" PRIu64 ",", lbound);
    result.Printf(" ubound = 0x%" PRIu64 , ubound);
    result.Printf(" (pointer value = 0x%" PRIu64 ",", value);
    result.Printf(" metadata = 0x%" PRIu64 ")\n", meta);
  }
}

Coverity is warning: 

  if ((lbound == one_cmpl64 || one_cmpl32) && ubound == 0) {

CID undefined (#1 of 1): Logical vs. bitwise operator
(CONSTANT_EXPRESSION_RESULT)logical_vs_bitwise: The expression lbound ==
18446744073709551615UL /* one_cmpl64 */ || true /* one_cmpl32 */ is suspicious
because it performs a Boolean operation on a constant other than 0 or 1.

Should this be:

  if ((lbound == one_cmpl64 || lbound == one_cmpl32) && ubound == 0) {