[llvm-bugs] [Bug 43717] New: Missing -Wuninitialized warning with some gotos
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Oct 18 14:50:10 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43717
Bug ID: 43717
Summary: Missing -Wuninitialized warning with some gotos
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: simon.marchi at polymtl.ca
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
Using the following
```
#include <stdlib.h>
#include <stdio.h>
int foo;
int main() {
int status;
if (foo) {
goto error;
}
goto end;
error:
status = 1;
end:
if (foo) {
status = 1;
}
return status;
}
```
Unless I'm missing something, I think there's a quite obvious path (when foo is
false) where status is used without being initialized. However, I don't get a
warning with:
$ clang-10 ~/build/babeltrace-clang/test.c -Werror -Wuninitialized
-Wsometimes-uninitialized
Removing either condition gives me -Wsometimes-uninitialized diagnostic, as
expected.
$ clang-10 --version
clang version 10.0.0-svn375132-1~exp1+0~20191017164644.1263~1.gbpd72b70 (trunk)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
--
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/20191018/e3fc4f06/attachment.html>
More information about the llvm-bugs
mailing list