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: [email protected]
Reporter: [email protected]
CC: [email protected]
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._______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs