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

            Bug ID: 51849
           Summary: False positives for -Wunused-but-set-variable with op
                    assignment operators (e.g. `|=`)
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: luismarq...@lowrisc.org
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@metafoo.co.uk

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to