[llvm-bugs] [Bug 36505] New: Clang-tidy: expression with calls to a non-pure function is considered as always-true
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Feb 24 04:45:22 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=36505
Bug ID: 36505
Summary: Clang-tidy: expression with calls to a non-pure
function is considered as always-true
Product: clang
Version: 5.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
Assignee: dcoughlin at apple.com
Reporter: pavel.kryukov at phystech.edu
CC: llvm-bugs at lists.llvm.org
Created attachment 19951
--> https://bugs.llvm.org/attachment.cgi?id=19951&action=edit
Example of always-true false positive with calls to a non-pure function
Clang-Tidy produces a false positive warning about always-true expression
(misc-redundant-expression check) if expression contains consequent calls to a
non-pure function which have different return values:
$> clang-tidy -checks='*' ldfile.c -- -Wall
15 warnings generated.
./ldfile.c:11:32: warning: logical expression is always true
[misc-redundant-expression]
if ((token = yylex()) != 1 || (token = yylex()) != 2) {
^
Suppressed 14 warnings (14 in non-user code).
$> clang ldfile.c -Wall -Wextra && ./a.out
false
The code is taken from GNU Binutils (/ld/ldfile.c) source file.
--
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/20180224/b0131c2a/attachment.html>
More information about the llvm-bugs
mailing list