https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84078
Bug ID: 84078
Summary: false positive for -Wmaybe-uninitialized
Product: gcc
Version: 8.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Target Milestone: ---
Created attachment 43265
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43265&action=edit
testcase
Hello,
The attached testcase compiled with -O2 -Wall produces
test.c:30:2: warning: 'c' may be used uninitialized in this function
[-Wmaybe-uninitialized]
printf("%d %d %d\n", a, b, c);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.c:30:2: warning: 'b' may be used uninitialized in this function
[-Wmaybe-uninitialized]
test.c:30:2: warning: 'a' may be used uninitialized in this function
[-Wmaybe-uninitialized]
while they are only used when `err' is equal to zero, and in the only case
where that happens, they do get initialized.
This is the minimal testcase I could reduce to, it seems both the asm snippet
and testing its result does make a difference, as well as the two ifs and the
three variables.
I could verify this with gcc snapshot 20180124 (Debian buster x86_64)
Samuel