Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: vladimir@codesourcery.com (Vladimir Prus)
Cc: gdb-patches@sources.redhat.com
Subject: [commit] Fix compile error (Re: [RFA] Async mode fixes.)
Date: Mon, 17 Mar 2008 14:11:00 -0000	[thread overview]
Message-ID: <200803171410.m2HEAWtC008777@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <200803051027.29575.vladimir@codesourcery.com> from "Vladimir Prus" at Mar 05, 2008 10:27:28 AM

Vladimir Prus wrote:

> +  long time_at_cmd_start;
[snip]
> +  if (target_can_async_p ())
> +    {
> +      time_at_cmd_start = get_run_time ();
[snip]
> +  if (target_can_async_p () && target_executing)
> +    {
> +      arg1 =
> +	(struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
> +      arg2 =
> +	(struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
> +      arg1->next = arg2;
> +      arg2->next = NULL;     
> +      arg1->data.longint = time_at_cmd_start;


this breaks compilation with:

/home/uweigand/fsf/gdb-head/gdb/top.c: In function `execute_command':
/home/uweigand/fsf/gdb-head/gdb/top.c:415: warning: 'time_at_cmd_start' might be used uninitialized in this function

and the compiler error seems somewhat justified as the compiler cannot
know that target_can_async_p () always returns the same value ...

Fixed by adding a dummy initializer, as already done for space_at_cmd_start.

Committed to mainline.

Bye,
Ulrich


ChangeLog:

	* top.c (execute_command): Fix uninitialized variable error.


Index: gdb/top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.133
diff -u -p -r1.133 top.c
--- gdb/top.c	14 Mar 2008 18:57:43 -0000	1.133
+++ gdb/top.c	17 Mar 2008 13:54:19 -0000
@@ -412,7 +412,7 @@ execute_command (char *p, int from_tty)
   char *line;
   struct continuation_arg *arg1;
   struct continuation_arg *arg2;
-  long time_at_cmd_start;
+  long time_at_cmd_start = 0;
 #ifdef HAVE_SBRK
   long space_at_cmd_start = 0;
 #endif


-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


  parent reply	other threads:[~2008-03-17 14:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-05  7:27 [RFA] Async mode fixes Vladimir Prus
2008-03-07 22:19 ` Nick Roberts
2008-03-07 22:33   ` Daniel Jacobowitz
2008-03-08  8:16     ` Vladimir Prus
2008-03-08  8:59   ` Vladimir Prus
2008-03-08 20:36     ` Nick Roberts
2008-03-08 20:54       ` Daniel Jacobowitz
2008-03-08 23:09         ` Nick Roberts
2008-03-09  0:01           ` Daniel Jacobowitz
2008-03-10  7:58       ` Vladimir Prus
2008-03-10  9:12         ` Nick Roberts
2008-03-10 10:02           ` Vladimir Prus
2008-03-10 22:06             ` Nick Roberts
2008-03-14 18:26 ` Daniel Jacobowitz
2008-03-14 18:58   ` Vladimir Prus
2008-03-17 14:11 ` Ulrich Weigand [this message]
2008-03-17 14:17   ` [commit] Fix compile error (Re: [RFA] Async mode fixes.) Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200803171410.m2HEAWtC008777@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=vladimir@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox