public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pault at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/99545] [11 Regression] ICE in gfc_trans_assignment since r11-6253-gce8dcc9105cbd404
Date: Mon, 15 Mar 2021 14:51:48 +0000	[thread overview]
Message-ID: <bug-99545-4-cQDTnsnyyV@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99545-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #14 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to Jürgen Reuter from comment #13)
> I confirm that with that patch our code compiles again, however, more or
> less all functionality fails because of runtime errors about 
> Fortran runtime error: Pointer actual argument '<some_name>' is not
> associated.
> Not sure whether this is related. Shall I open another PR? 
> Working on a reproducer for that problem.

Please work on a reproducer. I cannot quite see that the new problem is related
but keep this PR open for now.

The test below works, so the correct functionality of allocate is retained.
Your original reproducer no longer ICEs and gives the correct runtime error.

Cheers

Paul

! { dg-do compile }
! { dg-options "-fcheck=mem" }
!
! Test the fix for PR99545, in which the allocate statements caused an ICE.
!
! Contributed by Juergen Reuter  <juergen.reuter@desy.de>
!
module commands
  implicit none
!  private

  type, abstract :: range_t
     integer :: step_mode = 0
     integer :: n_step = 0
  end type range_t

  type, extends (range_t) :: range_int_t
     integer :: i_step = 1
  end type range_int_t

  type, extends (range_t) :: range_real_t
     real :: lr_step = 2.0
end type range_real_t

  type :: cmd_scan_t
!     private
     class(range_t), dimension(:), allocatable :: range
   contains
     procedure :: compile => cmd_scan_compile
  end type cmd_scan_t

contains

  subroutine cmd_scan_compile (cmd, sw)
    class(cmd_scan_t), intent(inout) :: cmd
    integer :: sw

    if (allocated (cmd%range)) deallocate (cmd%range)
    if (sw .eq. 1) then
      allocate (range_int_t :: cmd%range (3))
    else
      allocate (range_real_t :: cmd%range (3))
    end if
  end subroutine cmd_scan_compile

end module commands

  use commands
  class(cmd_scan_t), allocatable :: x
  integer :: i
  allocate (x)
  do i = 1, 2
    call x%compile (i)
    select type (y => x%range)
      type is (range_int_t)
        print *, y%i_step
      type is (range_real_t)
        print *, y%lr_step
    end select
  end do
end

  parent reply	other threads:[~2021-03-15 14:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11  7:46 [Bug fortran/99545] New: [11.0 regression] ICE in gfc_trans_assignment juergen.reuter at desy dot de
2021-03-11  7:47 ` [Bug fortran/99545] " juergen.reuter at desy dot de
2021-03-11  8:46 ` [Bug fortran/99545] [11 Regression] " rguenth at gcc dot gnu.org
2021-03-11  9:42 ` marxin at gcc dot gnu.org
2021-03-11 11:13 ` juergen.reuter at desy dot de
2021-03-11 13:02 ` marxin at gcc dot gnu.org
2021-03-11 13:04 ` juergen.reuter at desy dot de
2021-03-11 14:43 ` juergen.reuter at desy dot de
2021-03-11 14:52 ` juergen.reuter at desy dot de
2021-03-11 16:01 ` [Bug fortran/99545] [11 Regression] ICE in gfc_trans_assignment since r11-6253-gce8dcc9105cbd404 marxin at gcc dot gnu.org
2021-03-15  8:34 ` pault at gcc dot gnu.org
2021-03-15  9:33 ` cvs-commit at gcc dot gnu.org
2021-03-15 11:09 ` cvs-commit at gcc dot gnu.org
2021-03-15 12:09 ` cvs-commit at gcc dot gnu.org
2021-03-15 13:15 ` juergen.reuter at desy dot de
2021-03-15 14:51 ` pault at gcc dot gnu.org [this message]
2021-03-15 14:52 ` juergen.reuter at desy dot de
2021-03-15 17:50 ` pault at gcc dot gnu.org

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=bug-99545-4-cQDTnsnyyV@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).