This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit#2+7.3] Re: [patch 1/2] physname reg.: linespec minsym fallback
On Mon, 04 Jul 2011 15:13:57 +0200, Ulrich Weigand wrote:
> On some machines (RHEL 5.6 with GCC 4.1.2 system compiler) I'm now seeing:
>
> cc1: warnings being treated as errors
> /home/kwerner/dailybuild/spu-tc-2011-07-04/gdb-head/src/gdb/linespec.c: In function 'decode_line_1':
> /home/kwerner/dailybuild/spu-tc-2011-07-04/gdb-head/src/gdb/linespec.c:928: warning: 'values.nelts' may be used uninitialized in this function
> /home/kwerner/dailybuild/spu-tc-2011-07-04/gdb-head/src/gdb/linespec.c:928: warning: 'values.sals' may be used uninitialized in this function
>
> Should there be an initializer somewhere?
This false GCC warning I have seen when TRY_CATCH is in use like in this case.
Curiously I failed to reproduce this warning on gcc-4.1.2-50.el5.x86_64.
Anyway checked in HEAD (below) and in 7.3:
http://sourceware.org/ml/gdb-cvs/2011-07/msg00055.html
Thanks,
Jan
http://sourceware.org/ml/gdb-cvs/2011-07/msg00054.html
--- src/gdb/ChangeLog 2011/07/01 20:27:58 1.13154
+++ src/gdb/ChangeLog 2011/07/04 14:16:13 1.13155
@@ -1,3 +1,8 @@
+2011-07-04 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix false GCC warning.
+ * linespec.c (decode_line_1): Initialize values.
+
2011-07-01 Jan Kratochvil <jan.kratochvil@redhat.com>
* linespec.c (find_method): Accept the function type automatically only
--- src/gdb/linespec.c 2011/07/01 20:27:58 1.125
+++ src/gdb/linespec.c 2011/07/04 14:16:14 1.126
@@ -932,6 +932,9 @@
if (is_quote_enclosed)
++saved_arg;
+ /* Initialize it just to avoid a GCC false warning. */
+ memset (&values, 0, sizeof (values));
+
TRY_CATCH (ex, RETURN_MASK_ERROR)
{
values = decode_compound (argptr, funfirstline, canonical,