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

Re: [patch, fortran] PR31129 - warning on unused parameters


Daniel Franke wrote:
2007-07-09 Daniel Franke <franke.daniel@gmail.com>

        PR fortran/31129
        * trans-decl.c (generate_local_decl) Emit a warning if an unused
        parameter is found.

2007-07-09 Daniel Franke <franke.daniel@gmail.com>

        PR fortran/31129
        * gfortran.dg/parameter_unused.f90: New test.

Regtested on i686-pc-linux-gnu. Ok for trunk?

I think this is definitely ok, but since I've not done much work lately, you may want to wait for someone else to chime in.


I'd like to take the opportunity to suggest something related that I wanted to do for some time, but never got around to doing: currently the frontend only keeps track of whether a symbol is at all referenced. Instead we should introduce independent attributes attr.written and attr.read, and then use these to print more accurate warnings for unused variables from inside the frontend, and no longer (at least for non-character scalars) rely on the middleend.

This will allow us to fix PR 13615, and (to some extent at least) PRs 20520 and 28004. Also, the middleend will never know that
print *, x
end
makes use of an uninitialized x, as it only sees that x' address is taken, but it can't tell whether x is written or read in the I/O function. For the FE this is fairly obvious with my suggested change.


Cheers,
- Tobi


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