Jan Kratochvil | 20 Mar 2011 16:27
Picon
Favicon

archer-sergiodj-stap -O2 -Wall warnings=errors

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
 <at>  <at>  -780,7 +780,9  <at>  <at>  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
(Continue reading)

Sergio Durigan Junior | 21 Mar 2011 06:09
Picon
Favicon

Re: archer-sergiodj-stap -O2 -Wall warnings=errors

Hi Jan,

Jan Kratochvil <jan.kratochvil@...> writes:

> 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]

Thanks for pointing out those errors.  They were fixed today (Sunday)
afternoon, after you tried to compile my branch.  I compiled it here
with -O2 -Wall and everything worked.

Thanks.


Gmane