public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Sergio Durigan <sdurigan@redhat.com>
Cc: archer@sourceware.org
Subject: archer-sergiodj-stap -O2 -Wall warnings=errors
Date: Sun, 20 Mar 2011 15:27:00 -0000	[thread overview]
Message-ID: <20110320152726.GA8505@host1.jankratochvil.net> (raw)

Hi Sergio,

with -O2 (+some -Wall or so options possibly - what applies for Fedora builds)
one gets:

gcc-4.6.0-0.14.fc15.x86_64
stap-probe.c: In function ‘stap_fetch_reg_value’:
stap-probe.c:923:12: error: ‘aop’ may be used uninitialized in this function [-Werror=uninitialized]
stap-probe.c:919:10: error: ‘ret’ may be used uninitialized in this function [-Werror=uninitialized]
stap-probe.c: In function ‘stap_evaluate_conditionally’:
stap-probe.c:1184:3: error: ‘res’ may be used uninitialized in this function [-Werror=uninitialized]

The attached patch needs a review, I have only briefly checked it is not
completely bogus.


Thanks,
Jan


--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -780,7 +780,9 @@ stap_fetch_reg_value (struct stap_evaluation_info *eval_info,
 #define REG_NAME_MAX_SIZE 20
   char regname[REG_NAME_MAX_SIZE + 1];
   int len, regnum, indirect_p = 0;
-  struct value *ret;
+  /* GCC false warning: ‘ret’ may be used uninitialized in this function
+     */
+  struct value *ret = NULL;
   
   /* The function which called us did not check if the expression
      buffer was empty.  */
@@ -851,7 +853,9 @@ stap_fetch_reg_value (struct stap_evaluation_info *eval_info,
   if (indirect_p)
     {
       struct type *t = NULL;
-      enum agent_op aop;
+      /* GCC false warning: ‘aop’ may be used uninitialized in this function.
+         */
+      enum agent_op aop = 0;
 
       /* If the user has specified that the register must be indirected,
 	 we should know what's the correct type to cast it before making
@@ -949,7 +953,9 @@ stap_evaluate_single_operand (struct stap_evaluation_info *eval_info)
   struct gdbarch *gdbarch = eval_info->gdbarch;
   struct frame_info *frame = eval_info->frame;
   enum stap_arg_bitness bitness = eval_info->bitness;
-  struct value *res;
+  /* GCC false warning: ‘res’ may be used uninitialized in this function
+     */
+  struct value *res = NULL;
 
   switch (*eval_info->exp_buf)
     {

             reply	other threads:[~2011-03-20 15:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-20 15:27 Jan Kratochvil [this message]
2011-03-21  5:10 ` Sergio Durigan Junior

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=20110320152726.GA8505@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=archer@sourceware.org \
    --cc=sdurigan@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).