[Patch, fortran] PR18111 - spurious warnings with -W -Wunused

Paul Thomas paulthomas2@wanadoo.fr
Fri Aug 18 05:14:00 GMT 2006


:ADDPATCH fortran:

The source of this problem is that various of the declarations that are 
made by the compiler are not marked as either being TREE_USED or 
DECL_ARTIFICIAL.  Since none can be referenced by the original fortran, 
it is the latter flag which should be set.  As explained in both the  
ChangeLog and the testcase, the three categories of declaration that are 
now so marked are:

(i) Dummy arrays, where a copy or a new array is made.  Here the 
original is set DECL_ARTIFICAL;
(ii) The __ENTRY dummy in entry_master functions; and
(iii) The parameters, representing the original dummies, in entry thunks.

(i) is spread over two functions because gfc_build_dummy_array_decl 
resets the backend_decl for some arrays.  Before this is done, the 
artificial flag is set.

The testcase is a straight forward check that the above work.  Rather 
than using compiler flags -W and -Wunused, I used -Wunused-parameter, 
since that was always where the problem was.  However, the original 
flags would catch regressions for which we do not otherwise check and I 
am open to setting it that way.

Regtested on SUSE10.1/amd64 - OK for trunk and 4.1?

Paul

2006-08-18  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/18111
    * trans-decl.c (gfc_build_dummy_array_decl): Before resetting
    reference to backend_decl, set it DECL_ARTIFICIAL.
    (gfc_get_symbol_decl): Likewise for original dummy decl, when
    a copy is made of an array.
    (create_function_arglist): Likewise for the _entry paramter
    in entry_masters.
    (build_entry_thunks): Likewise for dummies in entry thunks.

2006-08-18  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/18111
    * gfortran.dg/unused_artificial_dummies_1.f90: New test.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr18111.diff
Type: text/x-patch
Size: 4147 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20060818/caa3a8d4/attachment.bin>


More information about the Fortran mailing list