public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/94270] New: Bogus unused dummy argument warning/error
@ 2020-03-23 10:09 jellby at yahoo dot com
  2020-04-13 17:22 ` [Bug fortran/94270] " tkoenig at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jellby at yahoo dot com @ 2020-03-23 10:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94270

            Bug ID: 94270
           Summary: Bogus unused dummy argument warning/error
           Product: gcc
           Version: 7.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jellby at yahoo dot com
  Target Milestone: ---

Apparently, passing an external procedure as an argument inside an internal
procedure triggers it:

$ cat test.f90 
subroutine foo()
external bar
call meh(bar)
call foo_internal()
contains
  subroutine foo_internal()
    call meh(bar)
  end subroutine foo_internal
end subroutine foo

$ gfortran -c test.f90 -Wall
test.f90:7:17:

     call meh(bar)
                 1
Warning: Unused dummy argument ‘_formal_0’ at (1) [-Wunused-dummy-argument]

$ gfortran --version
GNU Fortran (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

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

* [Bug fortran/94270] Bogus unused dummy argument warning/error
  2020-03-23 10:09 [Bug fortran/94270] New: Bogus unused dummy argument warning/error jellby at yahoo dot com
@ 2020-04-13 17:22 ` tkoenig at gcc dot gnu.org
  2020-04-13 17:31 ` [Bug fortran/94270] [8/9/10 Regression] " tkoenig at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-04-13 17:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94270

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |tkoenig at gcc dot gnu.org
   Last reconfirmed|                            |2020-04-13
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Confirmed.

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

* [Bug fortran/94270] [8/9/10 Regression] Bogus unused dummy argument warning/error
  2020-03-23 10:09 [Bug fortran/94270] New: Bogus unused dummy argument warning/error jellby at yahoo dot com
  2020-04-13 17:22 ` [Bug fortran/94270] " tkoenig at gcc dot gnu.org
@ 2020-04-13 17:31 ` tkoenig at gcc dot gnu.org
  2020-04-13 18:00 ` tkoenig at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-04-13 17:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94270

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
   Target Milestone|---                         |8.5
            Summary|Bogus unused dummy argument |[8/9/10 Regression] Bogus
                   |warning/error               |unused dummy argument
                   |                            |warning/error
           Assignee|unassigned at gcc dot gnu.org      |tkoenig at gcc dot gnu.org

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
This should be a one-line fix.

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

* [Bug fortran/94270] [8/9/10 Regression] Bogus unused dummy argument warning/error
  2020-03-23 10:09 [Bug fortran/94270] New: Bogus unused dummy argument warning/error jellby at yahoo dot com
  2020-04-13 17:22 ` [Bug fortran/94270] " tkoenig at gcc dot gnu.org
  2020-04-13 17:31 ` [Bug fortran/94270] [8/9/10 Regression] " tkoenig at gcc dot gnu.org
@ 2020-04-13 18:00 ` tkoenig at gcc dot gnu.org
  2020-04-14 11:51 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-04-13 18:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94270

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Not quite a one-liner, but looks good:

diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 75a50c999b7..8f041f0a0a8 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -5317,7 +5317,6 @@ gfc_get_formal_from_actual_arglist (gfc_symbol *sym,
              s->ts.is_iso_c = 0;
              s->ts.is_c_interop = 0;
              s->attr.flavor = FL_VARIABLE;
-             s->attr.artificial = 1;
              if (a->expr->rank > 0)
                {
                  s->attr.dimension = 1;
@@ -5332,6 +5331,7 @@ gfc_get_formal_from_actual_arglist (gfc_symbol *sym,
                s->maybe_array = maybe_dummy_array_arg (a->expr);
            }
          s->attr.dummy = 1;
+         s->attr.artificial = 1;
          s->declared_at = a->expr->where;
          s->attr.intent = INTENT_UNKNOWN;
          (*f)->sym = s;
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index e91a2795762..487e776f5dd 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -6072,7 +6072,7 @@ generate_local_decl (gfc_symbol * sym)
       /* Unused procedure passed as dummy argument.  */
       if (sym->attr.flavor == FL_PROCEDURE)
        {
-         if (!sym->attr.referenced)
+         if (!sym->attr.referenced && !sym->attr.artificial)
            {
              if (warn_unused_dummy_argument)
                gfc_warning (OPT_Wunused_dummy_argument,

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

* [Bug fortran/94270] [8/9/10 Regression] Bogus unused dummy argument warning/error
  2020-03-23 10:09 [Bug fortran/94270] New: Bogus unused dummy argument warning/error jellby at yahoo dot com
                   ` (2 preceding siblings ...)
  2020-04-13 18:00 ` tkoenig at gcc dot gnu.org
@ 2020-04-14 11:51 ` cvs-commit at gcc dot gnu.org
  2020-04-14 14:16 ` [Bug fortran/94270] [8/9 " cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-14 11:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94270

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Thomas Kथà¤nig <tkoenig@gcc.gnu.org>:

https://gcc.gnu.org/g:3b0e49a52e1884b501861c128b0a98dec50bdd2e

commit r10-7712-g3b0e49a52e1884b501861c128b0a98dec50bdd2e
Author: Thomas König <tkoenig@gcc.gnu.org>
Date:   Tue Apr 14 13:50:51 2020 +0200

    Fix PR 94270 by not warning about artifical dummy arguments.

    2020-04-14  Thomas Koenig  <tkoenig@gcc.gnu.org>

            PR fortran/94270
            * interface.c (gfc_get_formal_from_actual_arglist): Always
            set artificial attribute for symbols.
            * trans-decl.c (generate_local_decl): Do not warn if the
            symbol is artifical.

    2020-04-14  Thomas Koenig  <tkoenig@gcc.gnu.org>

            PR fortran/94270
            * gfortran.dg/warn_unused_dummy_argument_6.f90: New test.

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

* [Bug fortran/94270] [8/9 Regression] Bogus unused dummy argument warning/error
  2020-03-23 10:09 [Bug fortran/94270] New: Bogus unused dummy argument warning/error jellby at yahoo dot com
                   ` (3 preceding siblings ...)
  2020-04-14 11:51 ` cvs-commit at gcc dot gnu.org
@ 2020-04-14 14:16 ` cvs-commit at gcc dot gnu.org
  2020-04-14 14:25 ` jellby at yahoo dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-14 14:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94270

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Thomas Kथà¤nig
<tkoenig@gcc.gnu.org>:

https://gcc.gnu.org/g:7c94472580af3e2328bebb1493e7693c2b9cadc2

commit r9-8497-g7c94472580af3e2328bebb1493e7693c2b9cadc2
Author: Thomas König <tkoenig@gcc.gnu.org>
Date:   Tue Apr 14 16:15:49 2020 +0200

    Backport from trunk of the fix for PR 94270.

    2020-04-14  Thomas Koenig  <tkoenig@gcc.gnu.org>

            Backport from trunk
            PR fortran/94270
            * gfortran.dg/warn_unused_dummy_argument_6.f90: New test.

    2020-04-14  Thomas Koenig  <tkoenig@gcc.gnu.org>

            PR fortran/94270
            * gfortran.dg/warn_unused_dummy_argument_6.f90: New test.

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

* [Bug fortran/94270] [8/9 Regression] Bogus unused dummy argument warning/error
  2020-03-23 10:09 [Bug fortran/94270] New: Bogus unused dummy argument warning/error jellby at yahoo dot com
                   ` (4 preceding siblings ...)
  2020-04-14 14:16 ` [Bug fortran/94270] [8/9 " cvs-commit at gcc dot gnu.org
@ 2020-04-14 14:25 ` jellby at yahoo dot com
  2020-04-14 14:35 ` tkoenig at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jellby at yahoo dot com @ 2020-04-14 14:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94270

--- Comment #6 from Ignacio Fernández Galván <jellby at yahoo dot com> ---
Will the fix be backported to gcc7? I noticed this when Ubuntu updated the gcc7
version, so I would like to have the chance of seeing it fixed eventually too.

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

* [Bug fortran/94270] [8/9 Regression] Bogus unused dummy argument warning/error
  2020-03-23 10:09 [Bug fortran/94270] New: Bogus unused dummy argument warning/error jellby at yahoo dot com
                   ` (5 preceding siblings ...)
  2020-04-14 14:25 ` jellby at yahoo dot com
@ 2020-04-14 14:35 ` tkoenig at gcc dot gnu.org
  2020-04-14 16:48 ` cvs-commit at gcc dot gnu.org
  2020-04-14 16:49 ` tkoenig at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-04-14 14:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94270

--- Comment #7 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Ignacio Fernández Galván from comment #6)
> Will the fix be backported to gcc7? I noticed this when Ubuntu updated the
> gcc7 version, so I would like to have the chance of seeing it fixed
> eventually too.

I'm afraid not, gcc 7 is no longer maintained.  I will backport to gcc 8,
so when the final release of gcc 8 occurs (in about a year), it
will be included.

Alternatively, Ubuntu might decide to package gcc 9 earlier than that.

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

* [Bug fortran/94270] [8/9 Regression] Bogus unused dummy argument warning/error
  2020-03-23 10:09 [Bug fortran/94270] New: Bogus unused dummy argument warning/error jellby at yahoo dot com
                   ` (6 preceding siblings ...)
  2020-04-14 14:35 ` tkoenig at gcc dot gnu.org
@ 2020-04-14 16:48 ` cvs-commit at gcc dot gnu.org
  2020-04-14 16:49 ` tkoenig at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-14 16:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94270

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Thomas Kथà¤nig
<tkoenig@gcc.gnu.org>:

https://gcc.gnu.org/g:5e67ee3aa084a54f59c0848c32c17faddbb04c4c

commit r8-10179-g5e67ee3aa084a54f59c0848c32c17faddbb04c4c
Author: Thomas König <tkoenig@gcc.gnu.org>
Date:   Tue Apr 14 18:45:59 2020 +0200

    Backport from trunk of the fix for PR 94270.

    2020-04-14  Thomas Koenig  <tkoenig@gcc.gnu.org>

            Backport from trunk.
            PR fortran/94270
            * trans-decl.c (generate_local_decl): Do not warn if the
            symbol is artifical.

    2020-04-14  Thomas Koenig  <tkoenig@gcc.gnu.org>

            Backport from trunk
            PR fortran/94270
            * gfortran.dg/warn_unused_dummy_argument_6.f90: New test.

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

* [Bug fortran/94270] [8/9 Regression] Bogus unused dummy argument warning/error
  2020-03-23 10:09 [Bug fortran/94270] New: Bogus unused dummy argument warning/error jellby at yahoo dot com
                   ` (7 preceding siblings ...)
  2020-04-14 16:48 ` cvs-commit at gcc dot gnu.org
@ 2020-04-14 16:49 ` tkoenig at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-04-14 16:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94270

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #9 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Well, should be fixed now.

Onto new shores...

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

end of thread, other threads:[~2020-04-14 16:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-23 10:09 [Bug fortran/94270] New: Bogus unused dummy argument warning/error jellby at yahoo dot com
2020-04-13 17:22 ` [Bug fortran/94270] " tkoenig at gcc dot gnu.org
2020-04-13 17:31 ` [Bug fortran/94270] [8/9/10 Regression] " tkoenig at gcc dot gnu.org
2020-04-13 18:00 ` tkoenig at gcc dot gnu.org
2020-04-14 11:51 ` cvs-commit at gcc dot gnu.org
2020-04-14 14:16 ` [Bug fortran/94270] [8/9 " cvs-commit at gcc dot gnu.org
2020-04-14 14:25 ` jellby at yahoo dot com
2020-04-14 14:35 ` tkoenig at gcc dot gnu.org
2020-04-14 16:48 ` cvs-commit at gcc dot gnu.org
2020-04-14 16:49 ` tkoenig 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).