public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* nlmconv.c - warning: value computed is not used
@ 2010-12-07 23:04 Bernd Jendrissek
  2010-12-08  5:22 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Bernd Jendrissek @ 2010-12-07 23:04 UTC (permalink / raw)
  To: binutils

In message <477B8342.60604@redhat.com> Nick Clifton wrote:
>> .././binutils/nlmconv.c: In function 'main':
>> .././binutils/nlmconv.c:1081: warning: value computed is not used
>>
>> but is it safe to ignore this warning?
>
>Possibly, but it is hard to be sure without being able to reproduce the bug.
>(I tried with my local sources, but I did not see this warning).  What does
>line 1081 in nlmconv.c in your sources look like ?  Is it this:
>
>   strncpy (nlm_variable_header (outbfd)->oldThreadName, " LONG",
>	   NLM_OLD_THREAD_NAME_LENGTH);
>
>[snip other alternative]

This is it in my case.

I'm using GCC 4.3.1, compiling binutils from a git mirror [*], and
trying random things to make the warning go away (I'm not really
interested in nlmconv itself, so I just #if 0'ed the call out), I
found that replacing NLM_OLD_THREAD_NAME_LENGTH with 7 or more
placated GCC; 6 and below (including the #definition or 5) provoked
the warning.  It's as if GCC insists that you write a buffer overflow
bug!  If GCC was somehow omniscient enough to reason that " LONG"
never gets used, fine, but I don't see how this can be the case, as
just a few lines later outbfd "escapes" out of main() into
abfd_close().

I'd be happy to follow suggestions on how to investigate this,
although trying later versions of GCC means getting quite a few ducks
in a row.

[*] commit message of the revision I was building says:

commit 93cf20549fb5a4cd15cdf0e2a5d68b2f415eeceb
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri Jul 16 14:52:14 2010 +0000

            * corefile.c (core_sym_class): Fix handling of subprogram names
            and add support for cloned function names.

(I fetched some more git bits but the code in the vicinity of the
strncpy doesn't seem to have changed since July 16.)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-10 14:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-07 23:04 nlmconv.c - warning: value computed is not used Bernd Jendrissek
2010-12-08  5:22 ` Alan Modra
2010-12-10 14:18   ` Bernd Jendrissek

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).