public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/52602] New: false compilation warning of uninitialized variable
@ 2012-03-16 14:06 asmwarrior at gmail dot com
2012-03-16 14:23 ` [Bug c/52602] " asmwarrior at gmail dot com
2012-03-16 16:06 ` manu at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: asmwarrior at gmail dot com @ 2012-03-16 14:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52602
Bug #: 52602
Summary: false compilation warning of uninitialized variable
Classification: Unclassified
Product: gcc
Version: 4.6.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: asmwarrior@gmail.com
Hi, when building gdb, I found a false warning, the code is below:
static void
print_one_vtable (struct gdbarch *gdbarch, struct value *value,
int max_voffset,
struct value_print_options *opts)
{
int i;
struct type *type = check_typedef (value_type (value));
struct value *vtable;
CORE_ADDR vt_addr;
vtable = gnuv3_get_vtable (gdbarch, type,
value_address (value)
+ value_embedded_offset (value));
vt_addr = value_address (value_field (vtable,
vtable_field_virtual_functions));
printf_filtered (_("vtable for '%s' @ %s (subobject @ %s):\n"),
TYPE_SAFE_NAME (type),
paddress (gdbarch, vt_addr),
paddress (gdbarch, (value_address (value)
+ value_embedded_offset (value))));
for (i = 0; i <= max_voffset; ++i)
{
struct value *vfn;
CORE_ADDR addr;
volatile struct gdb_exception ex;
printf_filtered ("[%d]: ", i);
vfn = value_subscript (value_field (vtable,
vtable_field_virtual_functions),
i);
if (gdbarch_vtable_function_descriptors (gdbarch))
vfn = value_addr (vfn);
TRY_CATCH (ex, RETURN_MASK_ERROR)
{
addr = value_as_address (vfn);
}
if (ex.reason < 0)
printf_filtered (_("<error: %s>"), ex.message);
else
print_function_pointer_address (gdbarch, addr, gdb_stdout,
opts->addressprint);
printf_filtered ("\n");
}
}
in GDB's source: gnu-v3-abi.c, the warning is:
.../../gdb/gdb/gnu-v3-abi.c: In function 'print_one_vtable.isra.2':
.../../gdb/gdb/gnu-v3-abi.c:892:33: error: 'addr' may be used uninitialized in
this function [-Werror=uninitialized]
and the bug is workaround by this patch:
http://sourceware.org/ml/gdb-cvs/2012-03/msg00203.html
Simply use: CORE_ADDR addr = 0;
Yuanhui Zhang
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/52602] false compilation warning of uninitialized variable
2012-03-16 14:06 [Bug c/52602] New: false compilation warning of uninitialized variable asmwarrior at gmail dot com
@ 2012-03-16 14:23 ` asmwarrior at gmail dot com
2012-03-16 16:06 ` manu at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: asmwarrior at gmail dot com @ 2012-03-16 14:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52602
--- Comment #1 from asmwarrior <asmwarrior at gmail dot com> 2012-03-16 14:06:08 UTC ---
BTW: here is the discussion in gdb's patch mail list.
http://sourceware.org/ml/gdb-patches/2012-03/msg00585.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/52602] false compilation warning of uninitialized variable
2012-03-16 14:06 [Bug c/52602] New: false compilation warning of uninitialized variable asmwarrior at gmail dot com
2012-03-16 14:23 ` [Bug c/52602] " asmwarrior at gmail dot com
@ 2012-03-16 16:06 ` manu at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: manu at gcc dot gnu.org @ 2012-03-16 16:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52602
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2012-03-16
CC| |manu at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-03-16 15:32:04 UTC ---
I know it is a pain in the ass to generate a (minimal) preprocessed testcase,
but this report is not very useful without it: http://gcc.gnu.org/bugs/
There are at least as many explanations for this as bugs are listed for
PR24639.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-16 15:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-16 14:06 [Bug c/52602] New: false compilation warning of uninitialized variable asmwarrior at gmail dot com
2012-03-16 14:23 ` [Bug c/52602] " asmwarrior at gmail dot com
2012-03-16 16:06 ` manu at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).