[llvm-bugs] [Bug 26557] New: When casting an unsigned result of ~ operator to a larger integer type, MSVC warns on that

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Feb 9 17:01:55 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26557

            Bug ID: 26557
           Summary: When casting an unsigned result of ~ operator to a
                    larger integer type, MSVC warns on that
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ruiu at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

We found that when we build LLVM/Clang on a 64-bit Windows, the MSVC compiler
prints out a few warnings about possible misuses of ~ operator.

http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/29601/steps/build%20lld/logs/warnings%20%2811%29

It warns if an unsigned result of ~ is extended to a larger integer type. For
example, if you have a function f(uint64_t) and a varaible x of type uint32_t,
it warns on f(~x).

This may be useful because for example the above case is not very obvious.
Should we warn on the same thing?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160210/0543f5a4/attachment.html>


More information about the llvm-bugs mailing list