public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/52789] New: gfortran sets -Wunused-parameter in the C sense as well as the Fortran sense
@ 2012-03-30 14:31 mathewc at nag dot co.uk
  2012-03-30 15:31 ` [Bug fortran/52789] " dominiq at lps dot ens.fr
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: mathewc at nag dot co.uk @ 2012-03-30 14:31 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52789
           Summary: gfortran sets -Wunused-parameter in the C sense as
                    well as the Fortran sense
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mathewc@nag.co.uk


I'm using

$ uname -a
Linux stonehenge 3.3.0-4.fc16.x86_64 #1 SMP Tue Mar 20 18:05:40 UTC 2012 x86_64
x86_64 x86_64 GNU/Linux

$ gfortran --version
GNU Fortran (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2)

and with

$ cat unused.f90
subroutine s(x)
integer, parameter :: i = 0
end

I get

$ gfortran -Wunused-parameter -c unused.f90
unused.f90:2.23:

integer, parameter :: i = 0
                       1
Warning: Unused parameter 'i' declared at (1)
unused.f90:1:0: warning: unused parameter ‘x’ [-Wunused-parameter]

I think the C warning used to be suppressed at 4.5(?).

Specifying -Wunused-dummy-argument gets rid of the C message:

$ gfortran -Wunused-parameter -Wunused-dummy-argument -c unused.f90
unused.f90:2.23:

integer, parameter :: i = 0
                       1
Warning: Unused parameter 'i' declared at (1)
unused.f90:1.14:

subroutine s(x)
              1
Warning: Unused dummy argument 'x' at (1)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/52789] gfortran sets -Wunused-parameter in the C sense as well as the Fortran sense
  2012-03-30 14:31 [Bug fortran/52789] New: gfortran sets -Wunused-parameter in the C sense as well as the Fortran sense mathewc at nag dot co.uk
@ 2012-03-30 15:31 ` dominiq at lps dot ens.fr
  2012-03-30 16:26 ` mathewc at nag dot co.uk
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2012-03-30 15:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-03-30 15:12:38 UTC ---
So?

Note that you have also

[macbook] f90/bug% gfc -Wall pr52789.f90
pr52789.f90:1.14:

subroutine s(x)
              1
Warning: Unused dummy argument 'x' at (1)
[macbook] f90/bug% gfc -Wall -Wextra pr52789.f90
pr52789.f90:2.23:

integer, parameter :: i = 0
                       1
Warning: Unused parameter 'i' declared at (1)
pr52789.f90:1.14:

subroutine s(x)
              1
Warning: Unused dummy argument 'x' at (1)

for gcc version 4.4.6 up to 4.8.0 (trunk).


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/52789] gfortran sets -Wunused-parameter in the C sense as well as the Fortran sense
  2012-03-30 14:31 [Bug fortran/52789] New: gfortran sets -Wunused-parameter in the C sense as well as the Fortran sense mathewc at nag dot co.uk
  2012-03-30 15:31 ` [Bug fortran/52789] " dominiq at lps dot ens.fr
@ 2012-03-30 16:26 ` mathewc at nag dot co.uk
  2012-04-02  7:41 ` tkoenig at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mathewc at nag dot co.uk @ 2012-03-30 16:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Mat Cross <mathewc at nag dot co.uk> 2012-03-30 16:22:34 UTC ---
(In reply to comment #1)
> So?

If I RTM I see:

"-Wunused-parameter
    Contrary to gcc's meaning of -Wunused-parameter, gfortran's implementation
of this option does not warn about unused dummy arguments (see
-Wunused-dummy-argument), but about unused PARAMETER values. -Wunused-parameter
is not included in -Wall but is implied by -Wall -Wextra."


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/52789] gfortran sets -Wunused-parameter in the C sense as well as the Fortran sense
  2012-03-30 14:31 [Bug fortran/52789] New: gfortran sets -Wunused-parameter in the C sense as well as the Fortran sense mathewc at nag dot co.uk
  2012-03-30 15:31 ` [Bug fortran/52789] " dominiq at lps dot ens.fr
  2012-03-30 16:26 ` mathewc at nag dot co.uk
@ 2012-04-02  7:41 ` tkoenig at gcc dot gnu.org
  2012-04-02  8:03 ` mathewc at nag dot co.uk
  2012-04-02  9:38 ` burnus at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2012-04-02  7:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2012-04-02 07:40:32 UTC ---
This may have been fixed with the fix for PR 48847.

Can you maybe check on trunk/4.7.0 ?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/52789] gfortran sets -Wunused-parameter in the C sense as well as the Fortran sense
  2012-03-30 14:31 [Bug fortran/52789] New: gfortran sets -Wunused-parameter in the C sense as well as the Fortran sense mathewc at nag dot co.uk
                   ` (2 preceding siblings ...)
  2012-04-02  7:41 ` tkoenig at gcc dot gnu.org
@ 2012-04-02  8:03 ` mathewc at nag dot co.uk
  2012-04-02  9:38 ` burnus at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mathewc at nag dot co.uk @ 2012-04-02  8:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Mat Cross <mathewc at nag dot co.uk> 2012-04-02 08:03:22 UTC ---
(In reply to comment #3)
> Can you maybe check on trunk/4.7.0 ?

I've just tried with

$ gfortran --version
GNU Fortran (GCC) 4.7.1 20120331 (prerelease)

$ gfortran -c -Wunused-parameter unused.f90
unused.f90:2.23:

integer, parameter :: i = 0
                       1
Warning: Unused parameter 'i' declared at (1)
unused.f90:1:0: warning: unused parameter ‘x’ [-Wunused-parameter]

and

$ gfortran --version
GNU Fortran (GCC) 4.8.0 20120330 (experimental) [trunk revision 185988]

$ gfortran -c -Wunused-parameter unused.f90
unused.f90:2.23:

integer, parameter :: i = 0
                       1
Warning: Unused parameter 'i' declared at (1)
unused.f90:1:0: warning: unused parameter ‘x’ [-Wunused-parameter]


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/52789] gfortran sets -Wunused-parameter in the C sense as well as the Fortran sense
  2012-03-30 14:31 [Bug fortran/52789] New: gfortran sets -Wunused-parameter in the C sense as well as the Fortran sense mathewc at nag dot co.uk
                   ` (3 preceding siblings ...)
  2012-04-02  8:03 ` mathewc at nag dot co.uk
@ 2012-04-02  9:38 ` burnus at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-04-02  9:38 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-04-02
                 CC|                            |burnus at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-04-02 09:38:34 UTC ---
Confirmed.

 * * *

We have for GCC in general:

  Language Independent Options
  Warning Options
   -Wunused-parameter
      Warn whenever a function parameter is unused aside from its declaration.
  (It is automatically enabled with -Wunused or -Wall.)

And gfortran specific:
  -Wunused-dummy-argument
     Warn about unused dummy arguments. This option is implied by -Wall.
  -Wunused-parameter
     Contrary to gcc's meaning of -Wunused-parameter, gfortran's implementation
     of this option does not warn about unused dummy arguments (see
     -Wunused-dummy-argument), but about unused "PARAMETER" values.
     -Wunused-parameter is not included in -Wall but is implied by -Wall
     -Wextra.

 * * *

TODO:

* "-Wunused" does not imply any of the Fortran -Wunused-* warnings.
  But it should! Interestingly, is does not even seem to enable the middle end
  warnings.

* If only -Wunused-parameter is used - but no flag which implies
  -Wunused-dummy-argument, the parameter has to be eliminated for the
  middle-end handling. Thus, we need a gfc_option.* for it - and ensure
  that warn_unused_parameter has the proper value (e.g. 0 if only
  -Wunused-parameter is used.)


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-04-02  9:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-30 14:31 [Bug fortran/52789] New: gfortran sets -Wunused-parameter in the C sense as well as the Fortran sense mathewc at nag dot co.uk
2012-03-30 15:31 ` [Bug fortran/52789] " dominiq at lps dot ens.fr
2012-03-30 16:26 ` mathewc at nag dot co.uk
2012-04-02  7:41 ` tkoenig at gcc dot gnu.org
2012-04-02  8:03 ` mathewc at nag dot co.uk
2012-04-02  9:38 ` burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).