public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "janus 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 10:48:00 -0000 [thread overview] Message-ID: <bug-47463-4-V5iXq0EaxJ@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 janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2011.01.31 10:29:20 AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org |gnu.org | Ever Confirmed|0 |1 --- Comment #5 from janus at gcc dot gnu.org 2011-01-31 10:29:20 UTC --- Alright, here is a draft patch: Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 169407) +++ gcc/fortran/resolve.c (working copy) @@ -5877,14 +5877,12 @@ resolve_typebound_subroutine (gfc_code *code) /* Deal with typebound operators for CLASS objects. */ expr = code->expr1->value.compcall.base_object; - if (expr && expr->symtree->n.sym->ts.type == BT_CLASS - && code->expr1->value.compcall.name) + if (expr && expr->ts.type == BT_CLASS && code->expr1->value.compcall.name) { /* Since the typebound operators are generic, we have to ensure that any delays in resolution are corrected and that the vtab is present. */ - ts = expr->symtree->n.sym->ts; - declared = ts.u.derived; + declared = expr->ts.u.derived; c = gfc_find_component (declared, "_vptr", true, true); if (c->ts.u.derived == NULL) c->ts.u.derived = gfc_find_derived_vtab (declared); @@ -5895,6 +5893,7 @@ resolve_typebound_subroutine (gfc_code *code) /* Use the generic name if it is there. */ name = name ? name : code->expr1->value.function.esym->name; code->expr1->symtree = expr->symtree; + code->expr1->ref = gfc_copy_ref (expr->ref); expr->symtree->n.sym->ts.u.derived = declared; gfc_add_vptr_component (code->expr1); gfc_add_component_ref (code->expr1, name); This fixes comment #1 and comment #4. For the original test case I now get: gfortran-4.6 -std=f2003 -c hydro_types.f90 gfortran-4.6 -std=f2003 -c hydro_state.f90 gfortran-4.6 -std=f2003 -c hydro_speeds.f90 gfortran-4.6 -std=f2003 -c hydro_grid.f90 gfortran-4.6 -std=f2003 -c hydro_flow.f90 hydro_flow.f90:55.13: call this%init(st, gr) 1 Error: Found no matching specific binding for the call to the GENERIC 'init' at (1) Changing this generic call to the corresponding specific type-bound procedure, I get: gfortran-4.6 -std=f2003 -c hydro_flow.f90 hydro_flow.f90:55.13: call this%init_comps(st, gr) 1 Error: Type mismatch in argument 'this' at (1); passed CLASS(flow_t) to CLASS(grid_t) And the same without type-binding: gfortran-4.6 -std=f2003 -c hydro_flow.f90 hydro_flow.f90:55.20: call init_comps(this, st, gr) 1 Error: Type mismatch in argument 'this' at (1); passed CLASS(flow_t) to CLASS(grid_t) The code does look valid to me (unless I'm missing something), so this seems to be another gfortran bug.
next prev parent reply other threads:[~2011-01-31 10:29 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 [this message] 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 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-V5iXq0EaxJ@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: linkBe 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).