public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: Paul Richard Thomas <paul.richard.thomas@gmail.com>,
	"fortran@gcc.gnu.org" <fortran@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch, fortran] PR98897 - Erroneous procedure attribute for associate name
Date: Tue, 2 Feb 2021 14:59:45 +0100	[thread overview]
Message-ID: <33375e26-9020-328a-5d64-4bfeb4862369@codesourcery.com> (raw)
In-Reply-To: <CAGkQGiKSobUg=WtUHv8UHgHeLM5_3kPLBSmzWV4CzG0808KU7w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1519 bytes --]

Hi Paul,

On 02.02.21 13:20, Paul Richard Thomas via Gcc-patches wrote:
> This is more or less 'obvious' and does not require any further explanation.

Well, I am not sure whether calling resolve is premature or not. In any
case, it still fails for the attached testcase. (Related but separate
issue.)

The second testcase fails with "Selector at (1) has no type" / "Symbol
'var' at (1) has no IMPLICIT type".

Disclaimer: I am not 100% sure whether those two or your/the PR's
testcase is valid. (It fails to compile with ifort 19.1. I have not read
the spec and assume that the original testcase is valid.)

Thus, please confirm that all three are valid. If so, do you see a way
to make the two new ones pass as well? If we are sure that the current
patch is still the right approach, I am also fine to do it stepwise.

Thanks,

Tobias

> Regtests with FC33/x86_64 - OK for master (and ....)?
>
> Paul
>
> Fortran: Fix calls to associate name typebound subroutines [PR98897].
>
> 2021-02-02  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.
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf

[-- Attachment #2: foo.f90 --]
[-- Type: text/x-fortran, Size: 694 bytes --]

module m
  implicit none
contains
  subroutine double(i)
    integer :: i
    i = 2*i
  end subroutine double

  function bar() result(res)
    procedure(double), pointer :: res
    res => double
  end function bar
  subroutine foo(i)
    integer :: i

    ! This works:
    procedure(), pointer :: proc
    call double(i)
    proc => bar()
    call proc(i)

    ! This fails:
    associate (var => bar())
      call var(i)  ! { dg-bogus "VARIABLE attribute of 'var' conflicts with PROCEDURE attribute" }
    end associate
  end subroutine foo

end module m

program test
  use m
  implicit none (type, external)
  integer :: i
  i = 50
  call foo(i)
  if (i /= 50*2*2) stop 1
end program test

[-- Attachment #3: foo3.f90 --]
[-- Type: text/x-fortran, Size: 570 bytes --]

module m
  implicit none
contains
  subroutine double(i)
    integer :: i
    i = 2*i
  end subroutine double

  function bar() result(res)
    procedure(double), pointer :: res
    res => double
  end function bar

  subroutine foo(i)
    integer :: i
    procedure(bar) :: var

    procedure(double), pointer :: proc
    associate (var => bar())
      proc => var
    end associate
    call proc(i)
  end subroutine foo

end module m

program test
  use m
  implicit none (type, external)
  integer :: i
  i = 50
  call foo(i)
  if (i /= 50*2) stop 1
end program test

  reply	other threads:[~2021-02-02 13:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02 12:20 Paul Richard Thomas
2021-02-02 13:59 ` Tobias Burnus [this message]
2021-02-02 15:05   ` Paul Richard Thomas
2021-02-02 15:56     ` Tobias Burnus
2021-02-12 13:36       ` Paul Richard Thomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=33375e26-9020-328a-5d64-4bfeb4862369@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=paul.richard.thomas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).