This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/63418] New: false positive with -Wmaybe-uninitialized
- From: "kcc at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 30 Sep 2014 16:47:43 +0000
- Subject: [Bug c/63418] New: false positive with -Wmaybe-uninitialized
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63418
Bug ID: 63418
Summary: false positive with -Wmaybe-uninitialized
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: kcc at gcc dot gnu.org
I know there are some known false positives with -Wmaybe-uninitialized, so this
might be a dup. I'd like to document this one just in case this is another
corner case.
The test comes from a slightly modified glibc sources.
Tested with the fresh gcc trunk r215730.
% gcc w1.c -std=gnu99 -c -Wmaybe-uninitialized -O2
w1.c: In function âparse_expression.constpropâ:
w1.c:13311:28: warning: âextraâ may be used uninitialized in this function
[-Wmaybe-uninitialized]
if (name_len == extra[idx]
^
w1.c:13500:24: note: âextraâ was declared here
const unsigned char *extra;
Looking at the code:
"extra" is defined w/o initializer:
13500 const unsigned char *extra;
Then, it is initialized under if (nrules):
13522 if (nrules) {
...
13533 extra =
nrules never changes again.
The warning complains about "extra" being used in seek_collating_symbol_entry
w/o being initialied.
There are two calls to seek_collating_symbol_entry, they look like this:
13337 if (nrules != 0) {
13338 int32_t elem, idx;
13339 elem = seek_collating_symbol_entry(br_elem->opr.name, sym_name_len,
13456 if (nrules != 0) {
13457 elem = seek_collating_symbol_entry(name, name_len, symb_table,
table_size,
So, in both cases seek_collating_symbol_entry is called if nrules != 0, i.e.
'extra' is initialized.
If this is something new and unexpected I can prepare a better minimized
example, but I don't want to waste time if this is known.
I wasn't able to reproduce this on a tiny example.