This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

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



------- Comment #5 from rguenth at gcc dot gnu dot org  2010-04-25 20:13 -------
(In reply to comment #4)
> (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.

I can see that other people will exactly requrest the opposite (that is,
current behavior).  1) is always good, but unfortunately not possible
(and in fact people request that with more knowledge available from an
optimized program they should get improved warnings).


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881


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