[Bug c++/43881] warning attached to a function is emitted even though the function is not being called

bruno at clisp dot org gcc-bugzilla@gcc.gnu.org
Sat Apr 24 23:58:00 GMT 2010



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



More information about the Gcc-bugs mailing list