From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 6DC133854814; Tue, 16 Mar 2021 17:08:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6DC133854814 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Tobias_Burnus@mentor.com IronPort-SDR: pkJMjpc+zZE9MzIypFi4DE3lkSryHoJb8/BZzPA6BP0mmL+UdHV74mPOFiGHrZE/pXEYpPUewy SiphUEgL/Qc3d7ebYe1HaHwpO0wHO8tEesfiGgWvrQbvU3oYgaoF57NSdz9sSMi+Y1a6McTFUe WFD/83GEeY1ZTUyTnYZM4tBWV7iB4TmzC+7UCHaCW+fFsIzpAijC7ibnGNvS0X00V7d2z0oyjR Lc3SUkdVtxsyGIjfWJSQJ+WeKRjK490HzCElCPHSpb49ghhNYHxzWOb0gWybjMAfd3Cnm6yiAp Go4= X-IronPort-AV: E=Sophos;i="5.81,254,1610438400"; d="f90'?scan'208";a="61501246" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 16 Mar 2021 09:08:27 -0800 IronPort-SDR: IrL1P/hoRBMW8AEQKv+DzxQlqmEX6XzJfB+a8567QWIHG9BzQli3uY05E2crCKPUnjR5qU0TbE vdVCq36SX5vm1DIfhWtrKln0RfDWdRW0TsyVf4zx/PbxWu4dq3bW9PYYQolxEDMDfet62o5FIl L12OD7ZgsJ8kDxlD/zYBSQzpUGD5uX1Sz5xfONWc0h7OY30yCsbipvojN7wEDwWbDGymxyESHV NJTSIkFDqmKvtOZuWe80aenFJDXT0MKmkeyZSuuLMXFyaRd9Mkj1UhM9uTDU3TX7SdTE6U1v8x 1yA= Subject: Re: [Patch, fortran] PR99602 - [11 regression] runtime error: pointer actual argument not associated To: Paul Richard Thomas , "fortran@gcc.gnu.org" , gcc-patches CC: Juergen Reuter , Harald Anlauf References: From: Tobias Burnus Message-ID: <4ee532b7-eed8-8dd7-4e01-9a2e8004007c@codesourcery.com> Date: Tue, 16 Mar 2021 18:08:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------52013DF72BE3DD8B7A6A8C5C" Content-Language: en-US X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) To SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 17:08:31 -0000 --------------52013DF72BE3DD8B7A6A8C5C Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: quoted-printable Hi Paul, On 16.03.21 17:42, Paul Richard Thomas via Gcc-patches wrote: > Fortran: Fix runtime errors for class actual arguments [PR99602]. > * trans-array.c (gfc_conv_procedure_call): For class formal > arguments, use the _data field attributes for runtime errors. > * gfortran.dg/pr99602.f90: New test. Shouldn't there be also a testcase which triggers this run-time error? I might have messed up my testcase, but I think it should trigger? (Attached is an attempt to pass the nullified pointer as actual argument to a non-pointer argument; otherwise it is the same testcase as before.) Otherwise, at a glance, it looked sensible. Tobias ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 M=C3=BCnchen R= egistergericht M=C3=BCnchen HRB 106955, Gesch=C3=A4ftsf=C3=BChrer: Thomas H= eurung, Frank Th=C3=BCrauf --------------52013DF72BE3DD8B7A6A8C5C Content-Type: text/x-fortran; charset="UTF-8"; name="pr99602-2.f90" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr99602-2.f90" ! { dg-do compile } ! { dg-options "-fcheck=pointer -fdump-tree-original" } ! ! Test fix of PR99602, where a spurious runtime error was introduced ! by PR99112. This is the testcase in comment #6 of the PR. ! ! Contributed by Jeurgen Reuter ! module m implicit none private public :: m_t type :: m_t integer :: ii(100) end type m_t end module m module m2_testbed use m implicit none private public :: prepare_m2 procedure (prepare_m2_proc), pointer :: prepare_m2 => null () abstract interface subroutine prepare_m2_proc (m2) import class(m_t), intent(inout) :: m2 end subroutine prepare_m2_proc end interface end module m2_testbed module a use m use m2_testbed, only: prepare_m2 implicit none private public :: a_1 contains subroutine a_1 () class(m_t), pointer :: mm mm => null () call prepare_m2 (mm) ! Runtime error triggered here end subroutine a_1 end module a module m2 use m implicit none private public :: m2_t type, extends (m_t) :: m2_t private contains procedure :: read => m2_read end type m2_t contains subroutine m2_read (mm) class(m2_t), intent(out), target :: mm end subroutine m2_read end module m2 program main use m2_testbed use a, only: a_1 implicit none prepare_m2 => prepare_whizard_m2 call a_1 () contains subroutine prepare_whizard_m2 (mm) use m use m2 class(m_t), intent(inout) :: mm !if (.not. associated (mm)) allocate (m2_t :: mm) mm%ii = 100 select type (mm) type is (m2_t) call mm%read () end select end subroutine prepare_whizard_m2 end program main ! { dg-final { scan-tree-dump-times "_gfortran_runtime_error_at" 0 "original" } } ! { dg-final { scan-tree-dump-times "Pointer actual argument" 0 "original" } } --------------52013DF72BE3DD8B7A6A8C5C--