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>
Cc: "Jürgen Reuter" <juergen.reuter@desy.de>
Subject: Re: [Patch, fortran] PR99602 - [11 regression] runtime error: pointer actual argument not associated
Date: Fri, 26 Mar 2021 12:22:11 +0100	[thread overview]
Message-ID: <e8e878b8-1787-d3d3-c103-491586af721c@codesourcery.com> (raw)
In-Reply-To: <CAGkQGi+37A1-WeFGUQrUXdJVEOBngW6j2KzFJH+WJb9_SYmaBQ@mail.gmail.com>

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

Hi Paul,

I do not understand the !UNLIMITED_POLY(fsym) part of the patch.
In particular, your patch causes foo.f90 to fail by wrongly diagnosting:

   Fortran runtime error: Pointer actual argument 'cptr' is not associated

I have only did some light tests – but it seems that just removing
'&& !UNLIMITED_POLY(fsym)' seems to be enough. (But I did not run
the testsuite.)

Hence:
- Please include the attached testcases or some variants of them.
- Check that removing !UNLIMITED_POLY does not cause any regressions

If that works: OK for mainline

Thanks for looking into this issue and working on the patches.

Tobias

On 26.03.21 07:58, Paul Richard Thomas via Fortran wrote:
> This patch is straightforward but the isolation of the problem was rather
> less so. Many thanks to Juergen for testcase reduction.
>
> Regtested on FC33/x86_64 - OK for master?
>
> Paul
>
> Fortran: Fix problem with runtime pointer chack [PR99602].
>
> 2021-03-26  Paul Thomas  <pault@gcc.gnu.org>
>
> gcc/fortran/ChangeLog
>
> PR fortran/99602
> * trans-expr.c (gfc_conv_procedure_call): Use the _data attrs
> for class expressions and detect proc pointer evaluations by
> the non-null actual argument list.
>
> gcc/testsuite/ChangeLog
>
> PR fortran/99602
> * gfortran.dg/pr99602.f90: New test.
> * gfortran.dg/pr99602a.f90: New test.
> * gfortran.dg/pr99602b.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: bar.f90 --]
[-- Type: text/x-fortran, Size: 582 bytes --]

! { dg-do compile }
! { dg-options "-fcheck=pointer -fdump-tree-original" }
!
! PR fortran/99602
!

module m
  implicit none
contains
  subroutine wr(y)
    class(*) :: y
    stop 1
  end
end module m

use m
implicit none
integer, pointer :: iptr
class(*), pointer :: cptr

nullify (cptr, iptr)
call wr(iptr)
call wr(cptr)
end

! { dg-final { scan-tree-dump-times "_gfortran_runtime_error_at" "original" 2 } }
! { dg-final { scan-tree-dump-times "Pointer actual argument 'cptr'" "original" 1 } }
! { dg-final { scan-tree-dump-times "Pointer actual argument 'iptr'" "original" 1 } }

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

! { dg-do compile }
! { dg-options "-fcheck=pointer -fdump-tree-original" }
!
! PR fortran/99602
!

module m
  implicit none
contains
  subroutine wr(y)
    class(*), pointer :: y
    if (associated (y)) stop 1
  end
end module m

use m
implicit none
class(*), pointer :: cptr

nullify (cptr)
call wr(cptr)
end

! { dg-final { scan-tree-dump-not "_gfortran_runtime_error_at" "original" } }
! { dg-final { scan-tree-dump-not "Pointer actual argument" "original" } }

  reply	other threads:[~2021-03-26 11:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26  6:58 Paul Richard Thomas
2021-03-26 11:22 ` Tobias Burnus [this message]
2021-03-29  9:15   ` Paul Richard Thomas
  -- strict thread matches above, loose matches on Subject: below --
2021-03-16 16:42 Paul Richard Thomas
2021-03-16 17:08 ` Tobias Burnus
2021-03-18  8:46   ` Tobias Burnus
2021-03-18 13:22     ` 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=e8e878b8-1787-d3d3-c103-491586af721c@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=juergen.reuter@desy.de \
    --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).