<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - False positives for -Wunused-but-set-variable with op assignment operators (e.g. `|=`)"
   href="https://bugs.llvm.org/show_bug.cgi?id=51849">51849</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>False positives for -Wunused-but-set-variable with op assignment operators (e.g. `|=`)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>luismarques@lowrisc.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I think this is a false positive.
This happens with trunk (9aeecdfa8e91) and the latest RC (13.0.0-rc3):

$ cat test.c
void f(void) {
  int result = 0;
#ifdef BUG
    result |= 42;
#else
    result = result | 42;
#endif
}
$ ./bin/clang -Wunused-but-set-variable -c test.c
$ ./bin/clang -Wunused-but-set-variable -c test.c -DBUG
test.c:2:7: warning: variable 'result' set but not used
[-Wunused-but-set-variable]
  int result = 0;
      ^
1 warning generated.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>