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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

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

Reply via email to