This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

warning/error about possibly uninitialized 'exact' in find_line_symtab


I didn't want to deal with the stdint.h issue
I hit in 6.8 so I'm building 6.7.1.
I see now the mail threads where it was fixed pretty simply.
So maybe I'll go back to that.
 
 
In the meantime, with 6.7.1, I hit a simple problem (so far, still compiling)
warning variable 'exact' may be used uninitialized + -Werror.
 
 
Here is my patch:
 
 
-bash-3.2$ gdiff -u symtab.c.orig symtab.c
--- symtab.c.orig 2009-02-22 20:25:52.000000000 -0800
+++ symtab.c 2009-02-22 19:38:25.000000000 -0800
@@ -2249,7 +2249,7 @@
struct symtab *
find_line_symtab (struct symtab *symtab, int line, int *index, int *exact_match
)
{
- int exact;
+ int exact = { 0 };
/* BEST_INDEX and BEST_LINETABLE identify the smallest linenumber> LINE
so far seen. */
 
 
Sure, now it may be unoptimally unnecessarily initialized but
I don't think that is worth worrying about.
 
 
I use { 0 } instead of 0 because it is a more generic form that
can zero initialize "anything", except some unions on some compilers,
it might not always zero the entire thing.
 
 
Current source looks about the same.
 
 
My system is:
 
 
-bash-3.2$ gcc32 -v
Using built-in specs.
Target: hppa2.0w-hp-hpux11.11
Configured with: /src/gcc-4.3.3/configure -disable-nls -disable-bootstrap -prefi
x=/usr/local/32 -with-as=/usr/local/32/bin/gas -verbose
Thread model: posix
gcc version 4.3.3 (GCC)
 
 
-bash-3.2$ uname -a
HP-UX unknown B.11.11 U 9000/800 1595760578 unlimited-user license
 
 
gdb configured with:

 
$ /src/gdb-6.7.1/configure -disable-nls -prefix=/usr/local/32

 
and I rm -rf /src/gdb*/intl
and maybe altering PATH and/or CC, e.g. CC=gcc32, but gcc first
in $PATH is the same so that shouldn't matter here, by far.
 
 
 
Thanks,
- Jay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]