llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.97k stars 11.54k forks source link

alpha.deadcode.UnreachableCode false positive #30994

Open llvmbot opened 7 years ago

llvmbot commented 7 years ago
Bugzilla Link 31646
Version 4.0
OS Linux
Attachments Testcase allowing reproduction of the problem.
Reporter LLVM Bugzilla Contributor
CC @ASDenysPetrov

Extended Description

$ cat z.c union U { int a; };

int foo(union U u) { return u.a ? 1 : 0; }

$ clang-4.0 -cc1 -analyze -analyzer-checker=alpha.deadcode.UnreachableCode z.c z.c:6:20: warning: This statement is never executed return u.a ? 1 : 0; ^ 1 warning generated. $ clang-4.0 --version clang version 4.0.0-svn291446-1~exp1 (trunk) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/bin $

ASDenysPetrov commented 4 years ago

I could not reproduce the issue on the given code snippet. clang 10.x Can it be considered as resolved one?

llvmbot commented 7 years ago

assigned to @tkremenek