Skip to content

false positive in comparison with cast #11093

@llvmbot

Description

@llvmbot
Bugzilla Link 10721
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @tkremenek

Extended Description

clang version 3.0 (trunk 138324)
Target: x86_64-unknown-linux-gnu

Running this through the static analyser:

struct S { unsigned long long x; };
int f(struct S *p) {
if (p->x != (unsigned)p->x)
return 1;
else
return 2;
}

yields the warning:

clangbug.c:3:14: warning: Both operands to '!=' always have the same value
if (p->x != (unsigned)p->x)
~~~~ ^ ~~~~~~~~~~~~~~

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions