[Bug c/35534] New: Problem compiling gdb/symtab.c in GDB 6.7.1 using GCC 4.3.0 on Solaris 10

jonathan dot leffler at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Mar 11 03:36:00 GMT 2008


I'm not clear whether this is a problem in GCC or in GDB, so I'm asking both
teams.

Compiling gdb 6.7.1 on Solaris 10 using the newly installed GCC 4.3.0, I got a
compilation error (because of the -Werror option) as shown:

gcc -c -g -O2    -I. -I.././gdb -I.././gdb/config
-DLOCALEDIR="\"/usr/gdb/v6.7.1/share/locale\"" -DHAVE_CONFIG_H
-I.././gdb/../include/opcode -I.././gdb/../readline/.. -I../bfd
-I.././gdb/../bfd -I.././gdb/../include -I./../intl  -DMI_OUT=1 -DTUI=1  -Wall
-Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral
-Wno-pointer-sign -Wno-unused -Wno-switch -Wno-char-subscripts -Werror symtab.c
cc1: warnings being treated as errors
symtab.c: In function 'find_line_symtab':
symtab.c:2252: error: 'exact' may be used uninitialized in this function
make: *** [symtab.o] Error 1

The fragment in question was 'worked around' by adding the '= 0' to the
declaration of 'exact' at:

struct symtab *
find_line_symtab (struct symtab *symtab, int line, int *index, int
*exact_match)
{
  int exact = 0;

  /* BEST_INDEX and BEST_LINETABLE identify the smallest linenumber > LINE
     so far seen.  */

  int best_index;
  struct linetable *best_linetable;
  struct symtab *best_symtab;

  /* First try looking it up in the given symtab.  */
  best_linetable = LINETABLE (symtab);
  best_symtab = symtab;
  best_index = find_line_common (best_linetable, line, &exact);
  if (best_index < 0 || !exact)
    {


It is not clear to me that GCC is entitled to complain.  However, given that it
does, the workaround at least allows the compilation to proceed.

The configure script for GDB was run as:

./configure --prefix=/usr/gdb/v6.7.1

The configure script for GCC was run as:

../gcc-4.3.0/configure --prefix=/usr/gcc/v4.3.0 --with-mpfr=/usr/gnu
--with-gmp=/usr/gnu

I don't suppose it matters, but the version of MPFR was 2.3.1, compiled using
GCC 4.2.3, and the version of GMP was 4.1.2, which I apparently compiled a long
time ago with GCC 3.3.2.

The platform information from the GCC 4.2.0 config.log is:

## --------- ##
## Platform. ##
## --------- ##

hostname = black
uname -m = sun4u
uname -r = 5.10
uname -s = SunOS
uname -v = Generic_120011-14

/usr/bin/uname -p = sparc
/bin/uname -X     = System = SunOS
Node = black
Release = 5.10
KernelID = Generic_120011-14
Machine = sun4u
BusType = <unknown>
Serial = <unknown>
Users = <unknown>
OEM# = 0
Origin# = 1
NumCPU = 4

/bin/arch              = sun4
/usr/bin/arch -k       = sun4u
/usr/convex/getsysinfo = unknown
hostinfo               = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

...I don't see where to provide the symtab.i file; it is 427733 bytes long
uncompressed (but just 68724 bytes long in a bzip2 file)...  The information is
available on request.


-- 
           Summary: Problem compiling gdb/symtab.c in GDB 6.7.1 using GCC
                    4.3.0 on Solaris 10
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jonathan dot leffler at gmail dot com
 GCC build triplet: sparc-sun-solaris2.10
  GCC host triplet: sparc-sun-solaris2.10
GCC target triplet: sparc-sun-solaris2.10


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35534



More information about the Gcc-bugs mailing list