public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/47463] [OOP] ICE in gfc_add_component_ref
Date: Mon, 31 Jan 2011 21:53:00 -0000	[thread overview]
Message-ID: <bug-47463-4-cqduYIZumv@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-47463-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47463

--- Comment #9 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-31 21:42:29 UTC ---
(In reply to comment #6)
> > And the same without type-binding:
> >     call init_comps(this, st, gr)
> > Error: Type mismatch in argument 'this' at (1); passed CLASS(flow_t) to
> > CLASS(grid_t)

I looked closer at that version.

a)  It works if one reverses the order of subroutines (all versions)

Rich: That's a work around, which is sufficient to compile the whole program.
Note: You need a gfortran, which includes Janus' patch from comment 8.


b) For the failing version. The formal argument in compare_actual_formal alias
compare_parameter is odd:

(gdb) p a->expr->ts.u.derived->name
$17 = 0x2aaaacf0eae0 "__class_hydro_flow_Flow_t"
(gdb) p f->sym->ts.u.derived->name
$18 = 0x2aaaacf0eac0 "__class_hydro_grid_Grid_t_a"
(gdb) p f->sym->name
$19 = 0x2aaaace40fb0 "this"

Namely, the formal argument has the right name, but it is associated with the
wrong typespec!

 * * *

Reduced test case:

module hydro_grid
  type :: grid_t
   contains
     procedure :: assign
     generic   :: assignment(=) => assign
  end type grid_t
  public :: grid_t
contains
  subroutine assign (this, that)
    class(grid_t), intent(inout) :: this
    class(grid_t), intent(in)    :: that
  end subroutine assign
end module hydro_grid

module hydro_flow
  use hydro_grid
  type :: flow_t
     class(grid_t), allocatable  :: gr     ! Computation grid
  end type flow_t
contains
  subroutine init_params (this)
    class(flow_t), intent(out) :: this
    type(grid_t)               :: gr
   call init_comps(this, gr)
  end subroutine init_params
  subroutine init_comps (this, gr)
    class(flow_t), intent(out) :: this
    class(grid_t), intent(in)  :: gr
    this%gr = gr
  end subroutine init_comps
end module hydro_flow


  parent reply	other threads:[~2011-01-31 21:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-25 19:33 [Bug fortran/47463] New: " townsend at astro dot wisc.edu
2011-01-25 20:33 ` [Bug fortran/47463] [OOP] " burnus at gcc dot gnu.org
2011-01-25 20:53 ` mikael at gcc dot gnu.org
2011-01-27  5:33 ` townsend at astro dot wisc.edu
2011-01-30 16:01 ` janus at gcc dot gnu.org
2011-01-31 10:48 ` janus at gcc dot gnu.org
2011-01-31 12:08 ` burnus at gcc dot gnu.org
2011-01-31 15:13 ` janus at gcc dot gnu.org
2011-01-31 18:46 ` janus at gcc dot gnu.org
2011-01-31 21:53 ` burnus at gcc dot gnu.org [this message]
2011-02-02 18:25 ` dnovillo at gcc dot gnu.org
2011-02-09 18:11 ` janus at gcc dot gnu.org
2011-02-09 18:58 ` burnus at gcc dot gnu.org
2011-02-09 20:24 ` janus at gcc dot gnu.org
2011-02-09 20:35 ` janus at gcc dot gnu.org
2011-02-09 20:49 ` janus at gcc dot gnu.org
2011-02-09 21:10 ` burnus at gcc dot gnu.org
2011-02-10  6:25 ` paul.richard.thomas at gmail dot com

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-47463-4-cqduYIZumv@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).