[llvm-bugs] [Bug 35378] New: save-temps causes new bitwise parenthesis warning

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 21 15:37:26 PST 2017


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

            Bug ID: 35378
           Summary: save-temps causes new bitwise parenthesis warning
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nikhgupt at codeaurora.org
                CC: llvm-bugs at lists.llvm.org

Created attachment 19456
  --> https://bugs.llvm.org/attachment.cgi?id=19456&action=edit
test.cc

Building the above code with 
-Wall -Wextra -Werror  -O2 -g -fno-exceptions -o test.o -c test.cc

emits no warnings

however, with:
-Wall -Wextra -Werror  -O2 -g -save-temps  -fno-exceptions -o test.o -c test.cc

We get:
test.cc:16:101: error: '&' within '|' [-Werror,-Wbitwise-op-parentheses]
    if ((dbg_buffer[i] & ~(0xFFFF)) == (uint32)(((uint32)0xC1 << 24) |
(((module_id) & 0xFF) << 16) & ~(0xFFFF)))
                                                                     ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
test.cc:16:101: note: place parentheses around the '&' expression to silence
this warning
    if ((dbg_buffer[i] & ~(0xFFFF)) == (uint32)(((uint32)0xC1 << 24) |
(((module_id) & 0xFF) << 16) & ~(0xFFFF)))
                                                                               
                    ^
                                                                       (       
                               )

When looking into this further I noticed that in the case of -save-temps the
sourceLocation for the expression is not being considered as a macro.

-- 
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/20171121/6de1cd4b/attachment-0001.html>


More information about the llvm-bugs mailing list