This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/43881] warning attached to a function is emitted even though the function is not being called
- From: "bruno at clisp dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Apr 2010 23:58:21 -0000
- Subject: [Bug c++/43881] warning attached to a function is emitted even though the function is not being called
- References: <bug-43881-128@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from bruno at clisp dot org 2010-04-24 23:58 -------
(In reply to comment #2)
> It is called directly because safe_close's value is replaced in the
> indirect call. Since safe_close is static and not changed in the code
> at all, it is marked as read only and the initialized value can be
> used directly.
This is an explanation why gcc behaves like this, but not a justification.
1) GCC should try to make warnings independent of optimization settings.
2) GCC warns about a line of code that calls 'safe_close', which it should not
warn about. Only calls of 'close' should be warned about, and there are
no such calls in the source program.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881