[Bug middle-end/35534] 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 04:04:00 GMT 2008
------- Comment #5 from jonathan dot leffler at gmail dot com 2008-03-11 04:04 -------
After a 'mid-air collision':
The code for find_line_common() is in the same file, later on, but declared
static, so GCC can analyze it -- and then it is correct to complain:
static int
find_line_common (struct linetable *l, int lineno,
int *exact_match)
{
int i;
int len;
/* BEST is the smallest linenumber > LINENO so far seen,
or 0 if none has been seen so far.
BEST_INDEX identifies the item for it. */
int best_index = -1;
int best = 0;
if (lineno <= 0)
return -1;
if (l == 0)
return -1;
len = l->nitems;
for (i = 0; i < len; i++)
{
struct linetable_entry *item = &(l->item[i]);
if (item->line == lineno)
{
/* Return the first (lowest address) entry which matches. */
*exact_match = 1;
return i;
}
if (item->line > lineno && (best == 0 || item->line < best))
{
best = item->line;
best_index = i;
}
}
/* If we got here, we didn't get an exact match. */
*exact_match = 0;
return best_index;
}
The two early exits do leave exact unset. However, those cases leave
best_index in find_line_symtab less than zero, so the test would not access
exact in those cases. It is a bit hard for GCC to note that for all other
return cases, the returned value assigned to best_index is non-negative and
that exact is then set.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35534
More information about the Gcc-bugs
mailing list