[Patch, Fortran] PR 54224: [4.8 Regression] Bogus -Wunused-function warning with static function

Tobias Burnus burnus@net-b.de
Fri Oct 19 16:18:00 GMT 2012


Hi Janus,

Janus Weil wrote:
> I have found a fix that is rather trivial in the sense that it's a
> one-liner.

I think it is the proper fix.

> However, it may not be as trivial conceptually (in particular I'm not 100% sure what caused this regression in the first place

I think it is the combination of having "static" noninternal procedures 
(which is a new 4.8 feature) combined with the middle-end assumption 
that the FE marks procedures as TREE_USED. (The ME does mark them as 
TREE_USED, but too late.)

(The other question is why the diagnostic doesn't work for internal 
procedures - or for GNU C's nested function. I think also for module 
variables such a diagnostic would be useful. However, both are just 
missed diagnostics and not diagnostic-output regressions.)

> Anyway, it regtests cleanly and fixes the problem as advertised. Ok for trunk?

Yes. Thanks for the patch.

Tobias

> 2012-10-19  Janus Weil  <janus@gcc.gnu.org>
>
> 	PR fortran/54224
> 	* trans-expr.c (conv_function_val): Set TREE_USED.
>
> 2012-10-19  Janus Weil  <janus@gcc.gnu.org>
>
> 	PR fortran/54224
> 	* gfortran.dg/warn_unused_function.f90: New.



More information about the Gcc-patches mailing list