public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/98897] New: Erroneous procedure attribute for associate name
@ 2021-01-30  0:13 damian at sourceryinstitute dot org
  2021-02-01  8:56 ` [Bug fortran/98897] " burnus at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: damian at sourceryinstitute dot org @ 2021-01-30  0:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98897
           Summary: Erroneous procedure attribute for associate name
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: damian at sourceryinstitute dot org
  Target Milestone: ---

The behavior demonstrated below also occurs if the procedure definition is
moved to a submodule.  Workarounds include (1) declaring "output_data" as a
variable instead of an associate name or (2) making "output" a function
referencing it as such instead of calling it as a subroutine.

% cat bug.f90                             
module output_data_m
  implicit none

  type output_data_t
  contains
    procedure output
  end type

  interface
    module subroutine output(self)
      implicit none
      class(output_data_t) self
    end subroutine
  end interface

contains
  module procedure output
  end procedure
end module

  use output_data_m
  implicit none
  associate(output_data => output_data_t())
    call output_data%output
  end associate
end

% gfortran bug.f90
bug.f90:24:20:

   24 |     call output_data%output
      |                    1
Error: VARIABLE attribute of ‘output_data’ conflicts with PROCEDURE attribute
at (1)

% gfortran --version
GNU Fortran (GCC) 11.0.0 20201231 (experimental)

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

* [Bug fortran/98897] Erroneous procedure attribute for associate name
  2021-01-30  0:13 [Bug fortran/98897] New: Erroneous procedure attribute for associate name damian at sourceryinstitute dot org
@ 2021-02-01  8:56 ` burnus at gcc dot gnu.org
  2021-02-02 12:05 ` pault at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-02-01  8:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
match.c's gfc_match_call has:

  /* If this is a variable of derived-type, it probably starts a type-bound
     procedure call.  */
  if ((sym->attr.flavor != FL_PROCEDURE
       || gfc_is_function_return_value (sym, gfc_current_ns))
      && (sym->ts.type == BT_DERIVED || sym->ts.type == BT_CLASS))
    return match_typebound_call (st);

But here we have:
  sym->ts.type == BT_UNKNOWN, sym->attr.flavor == FL_VARIABLE

However, we do have: sym->assoc != NULL && sym->assoc->target != NULL and
'target' has:
  expr_type = EXPR_FUNCTION
  ts = {type = BT_UNKNOWN
  sym->assoc->target->symtree->n.sym
  $29 = {name = "output_data_t", module = "output_data_m",
  but the rest is also the default value.

Thus, the target needs to be resolved at some point – even when parsing '%' at
some point, the DT needs to be known.

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

* [Bug fortran/98897] Erroneous procedure attribute for associate name
  2021-01-30  0:13 [Bug fortran/98897] New: Erroneous procedure attribute for associate name damian at sourceryinstitute dot org
  2021-02-01  8:56 ` [Bug fortran/98897] " burnus at gcc dot gnu.org
@ 2021-02-02 12:05 ` pault at gcc dot gnu.org
  2021-02-02 16:28 ` damian at sourceryinstitute dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu.org @ 2021-02-02 12:05 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pault at gcc dot gnu.org
                 CC|                            |pault at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-02-02
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #2 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 50114
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50114&action=edit
Patch for the PR

The attached regtests too :-)

Thanks for the report, Damian.

Paul

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

* [Bug fortran/98897] Erroneous procedure attribute for associate name
  2021-01-30  0:13 [Bug fortran/98897] New: Erroneous procedure attribute for associate name damian at sourceryinstitute dot org
  2021-02-01  8:56 ` [Bug fortran/98897] " burnus at gcc dot gnu.org
  2021-02-02 12:05 ` pault at gcc dot gnu.org
@ 2021-02-02 16:28 ` damian at sourceryinstitute dot org
  2021-02-11 13:25 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: damian at sourceryinstitute dot org @ 2021-02-02 16:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Damian Rouson <damian at sourceryinstitute dot org> ---
Thanks for the quick fix, Paul!   Any chance of this being back-ported to the
10 branch?

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

* [Bug fortran/98897] Erroneous procedure attribute for associate name
  2021-01-30  0:13 [Bug fortran/98897] New: Erroneous procedure attribute for associate name damian at sourceryinstitute dot org
                   ` (2 preceding siblings ...)
  2021-02-02 16:28 ` damian at sourceryinstitute dot org
@ 2021-02-11 13:25 ` cvs-commit at gcc dot gnu.org
  2021-02-11 19:10 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-11 13:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Paul Thomas <pault@gcc.gnu.org>:

https://gcc.gnu.org/g:ff6903288d96aa1d28ae4912b1270985475f3ba8

commit r11-7188-gff6903288d96aa1d28ae4912b1270985475f3ba8
Author: Paul Thomas <pault@gcc.gnu.org>
Date:   Thu Feb 11 13:24:50 2021 +0000

    Fortran: Fix calls to associate name typebound subroutines [PR98897].

    2021-02-11  Paul Thomas  <pault@gcc.gnu.org>

    gcc/fortran
            PR fortran/98897
            * match.c (gfc_match_call): Include associate names as possible
            entities with typebound subroutines. The target needs to be
            resolved for the type.

    gcc/testsuite/
            PR fortran/98897
            * gfortran.dg/typebound_call_32.f90: New test.

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

* [Bug fortran/98897] Erroneous procedure attribute for associate name
  2021-01-30  0:13 [Bug fortran/98897] New: Erroneous procedure attribute for associate name damian at sourceryinstitute dot org
                   ` (3 preceding siblings ...)
  2021-02-11 13:25 ` cvs-commit at gcc dot gnu.org
@ 2021-02-11 19:10 ` cvs-commit at gcc dot gnu.org
  2021-02-11 19:11 ` pault at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-11 19:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Paul Thomas <pault@gcc.gnu.org>:

https://gcc.gnu.org/g:9d3b9a3e70e634c7c48bb12bb35ec8219024f98b

commit r10-9358-g9d3b9a3e70e634c7c48bb12bb35ec8219024f98b
Author: Paul Thomas <pault@gcc.gnu.org>
Date:   Thu Feb 11 13:24:50 2021 +0000

    Fortran: Fix calls to associate name typebound subroutines [PR98897].

    2021-02-11  Paul Thomas  <pault@gcc.gnu.org>

    gcc/fortran
            PR fortran/98897
            * match.c (gfc_match_call): Include associate names as possible
            entities with typebound subroutines. The target needs to be
            resolved for the type.

    gcc/testsuite/
            PR fortran/98897
            * gfortran.dg/typebound_call_32.f90: New test.

    (cherry picked from commit ff6903288d96aa1d28ae4912b1270985475f3ba8)

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

* [Bug fortran/98897] Erroneous procedure attribute for associate name
  2021-01-30  0:13 [Bug fortran/98897] New: Erroneous procedure attribute for associate name damian at sourceryinstitute dot org
                   ` (4 preceding siblings ...)
  2021-02-11 19:10 ` cvs-commit at gcc dot gnu.org
@ 2021-02-11 19:11 ` pault at gcc dot gnu.org
  2021-02-13 11:53 ` dominiq at lps dot ens.fr
  2021-02-23  0:43 ` damian at sourceryinstitute dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu.org @ 2021-02-11 19:11 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

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

--- Comment #6 from Paul Thomas <pault at gcc dot gnu.org> ---
Fixed on 10- and 11-branches.

Thanks for the report, Damian.

Paul

PS See PR99065 for the reason for the delay.

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

* [Bug fortran/98897] Erroneous procedure attribute for associate name
  2021-01-30  0:13 [Bug fortran/98897] New: Erroneous procedure attribute for associate name damian at sourceryinstitute dot org
                   ` (5 preceding siblings ...)
  2021-02-11 19:11 ` pault at gcc dot gnu.org
@ 2021-02-13 11:53 ` dominiq at lps dot ens.fr
  2021-02-23  0:43 ` damian at sourceryinstitute dot org
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2021-02-13 11:53 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Bader at lrz dot de

--- Comment #7 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
*** Bug 67744 has been marked as a duplicate of this bug. ***

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

* [Bug fortran/98897] Erroneous procedure attribute for associate name
  2021-01-30  0:13 [Bug fortran/98897] New: Erroneous procedure attribute for associate name damian at sourceryinstitute dot org
                   ` (6 preceding siblings ...)
  2021-02-13 11:53 ` dominiq at lps dot ens.fr
@ 2021-02-23  0:43 ` damian at sourceryinstitute dot org
  7 siblings, 0 replies; 9+ messages in thread
From: damian at sourceryinstitute dot org @ 2021-02-23  0:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Damian Rouson <damian at sourceryinstitute dot org> ---
Thanks, Paul and Tobias!

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

end of thread, other threads:[~2021-02-23  0:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-30  0:13 [Bug fortran/98897] New: Erroneous procedure attribute for associate name damian at sourceryinstitute dot org
2021-02-01  8:56 ` [Bug fortran/98897] " burnus at gcc dot gnu.org
2021-02-02 12:05 ` pault at gcc dot gnu.org
2021-02-02 16:28 ` damian at sourceryinstitute dot org
2021-02-11 13:25 ` cvs-commit at gcc dot gnu.org
2021-02-11 19:10 ` cvs-commit at gcc dot gnu.org
2021-02-11 19:11 ` pault at gcc dot gnu.org
2021-02-13 11:53 ` dominiq at lps dot ens.fr
2021-02-23  0:43 ` damian at sourceryinstitute dot 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).