From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A2E983858004; Sun, 21 Mar 2021 18:53:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A2E983858004 From: "pault at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/99602] [11 regression] runtime error: pointer actual argument not associated Date: Sun, 21 Mar 2021 18:53:48 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pault at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: pault at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 18:53:48 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99602 --- Comment #30 from Paul Thomas --- Created attachment 50442 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D50442&action=3Dedit Patch that "fixes" all versions of the problem.. so far :-) Hi Juergen, I think that this one does the job... it is even correct and regtests OK;-) I found that the gdb session was a miserable afair that didn't help at all because of the change in dwarf versions. I would up reducing the testcase to what you will find below. Please excuse my mutilation of Whizard! The chunk of whizard that you provided throws up all sorts of memories. In = the 1970's I used to go up to Caltech every Wednesday for Feynman and Gell-mann seminars. I was around for the earliest days of partons and the realisation that quarks might even be real. Paul module model_data type :: model_data_t type(modelpar_real_t), dimension(:), pointer :: par_real =3D> null () contains procedure :: get_par_data_ptr =3D> model_data_get_par_data_ptr_name procedure :: set =3D> field_data_set end type model_data_t type :: modelpar_real_t character (4) :: name real(4) :: value end type modelpar_real_t type(modelpar_real_t), target :: names(2) =3D [modelpar_real_t("foo ", 1)= , & modelpar_real_t("bar ", 2)] contains function model_data_get_par_data_ptr_name (model, name) result (ptr) class(model_data_t), intent(in) :: model character (*), intent(in) :: name class(modelpar_real_t), pointer :: ptr integer :: i ptr =3D> null () do i =3D 1, size (model%par_real) if (model%par_real(i)%name =3D=3D name) ptr =3D> model%par_real(i) end do end function model_data_get_par_data_ptr_name subroutine field_data_set (this, ptr) class(model_data_t), intent(inout) :: this class(modelpar_real_t), intent(in), pointer :: ptr if (associated (ptr)) then print *, "'ptr%value' =3D ", ptr%value else print *, "'ptr' not associated in 'field_data_set'" end if end subroutine end module model_data use model_data class(model_data_t), allocatable :: model class(modelpar_real_t), pointer :: name_ptr allocate (model_data_t :: model) model%par_real =3D> names ! name_ptr =3D> model%get_par_data_ptr ("bar ") ! call field_data_set (model, name_ptr) ! call field_data_set (model, model%get_par_data_ptr ("bar ")) call model%set (model%get_par_data_ptr ("bar ")) call model%set (model%get_par_data_ptr ("tea ")) end=