[llvm-bugs] [Bug 41684] New: missed -Wsometimes-uninitialized for switch statement without default
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed May 1 03:51:38 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=41684
Bug ID: 41684
Summary: missed -Wsometimes-uninitialized for switch statement
without default
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: masahiroy at kernel.org
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
[test case 1]
int foo(int x)
{
int y;
switch (x) {
case 1:
y = 1;
break;
}
return y;
}
[test case 2]
int foo(int x)
{
int y;
switch (x) {
case 1:
y = 1;
break;
default:
break;
}
return y;
}
The difference between [test case 1] and [test case 2]
is the presence of "default:' label.
$ clang -O2 -Wsometimes-uninitialized -c -o test.o test.c
produced the same object for both cases.
However, clang reports Wsometimes-uninitialized warning
for [test case 2], but does not for [test case 1].
--
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/20190501/e478fb18/attachment.html>
More information about the llvm-bugs
mailing list