This is the mail archive of the
mailing list for the elfutils project.
[Bug general/21011] "may be used uninitialized" error with -Werror=maybe-uninitialized
- From: "mark at klomp dot org" <sourceware-bugzilla at sourceware dot org>
- To: elfutils-devel at sourceware dot org
- Date: Wed, 19 Apr 2017 15:14:10 +0000
- Subject: [Bug general/21011] "may be used uninitialized" error with -Werror=maybe-uninitialized
- Auto-submitted: auto-generated
- References: <firstname.lastname@example.org/bugzilla/>
--- Comment #11 from Mark Wielaard <mark at klomp dot org> ---
So the flag that seem to trigger it is -Os (but only on 32bit systems?).
Proposed the following:
Author: Mark Wielaard <email@example.com>
Date: Wed Apr 19 17:07:46 2017 +0200
libelf: Initialize n to zero in elf_getarsym.
When building with gcc -Os it seems we can inline read_number_entries
but if that function fails then n will not be initialized. GCC seems not
to realize that in that case n won't be used at all. Explicitly initialize
n to zero to prevent a spurious error: 'n' may be used uninitialized in
this function [-Werror=maybe-uninitialized] in that case.
Signed-off-by: Mark Wielaard <firstname.lastname@example.org>
You are receiving this mail because:
You are on the CC list for the bug.