This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

nlmconv.c - warning: value computed is not used


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


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