public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "paul.richard.thomas at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/59198] [4.7/4.8/4.9 Regression] ICE on cyclically dependent polymorphic types
Date: Tue, 25 Feb 2014 13:44:00 -0000	[thread overview]
Message-ID: <bug-59198-4-0Wg6CqWWn3@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-59198-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #12 from paul.richard.thomas at gmail dot com <paul.richard.thomas at gmail dot com> ---
Dear Tobias,

I think that I have see the light!  In a particularly uninteresting
part of our Board Meeting, I took a look at the Doxygen documentation
of the compiler.  I was trying to figure out how it is possible to get
TYPE_SIZE_UNIT and no DECL_SIZE_UNIT.....

Right at the beginning of trans-decl.c (gfc_get_symbol_decl) is:

01193   /* Make sure that the vtab for the declared type is completed.  */
01194   if (sym->ts.type == BT_CLASS)
01195     {
01196       gfc_component *c = CLASS_DATA (sym);
01197       if (!c->ts.u.derived->backend_decl)
01198         {
01199           gfc_find_derived_vtab (c->ts.u.derived);
01200           gfc_get_derived_type (sym->ts.u.derived);
01201         }
01202     }

I think that the derived type should be built first, followed by the
vtable.  With the declared type being in a cyclic type definition, one
is asking for the size information to be unavailable/incorrect when
the vtable is built.  I suspect that the ICE is occurring when the
vtable is initialized.

I suspect that we should have:

01193   /* Make sure that the vtab for the declared type is completed.  */
01194   if (sym->ts.type == BT_CLASS)
01195     {
01196       gfc_component *c = CLASS_DATA (sym);
01197       if (!c->ts.u.derived->backend_decl)
01198         {
01198bis      gfc_symbol *s;
01199           gfc_get_derived_type (sym->ts.u.derived); /* Ensure
backend_decl is complete. */
01200           s = gfc_find_derived_vtab (c->ts.u.derived); /* Maybe
set backend_decl to NULL_TREE?  */
01200bis       gfc_get_symbol_decl (s); /* Build the vtable backend_decl.  */
01201         }
01202     }

It'll probably be wrong but I can only get to it tonight.

What are you up to?

Cheers

Paul

PS Must update Doxygen documentation on wiki and the bug statistics




---------- Forwarded message ----------
From: pault at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
Date: 25 February 2014 10:31
Subject: [Bug fortran/59198] [4.7/4.8/4.9 Regression] ICE on
cyclically dependent polymorphic types
To: pault@gcc.gnu.org


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

--- Comment #11 from Paul Thomas <pault at gcc dot gnu.org> ---
A correct version of the patch of comment#6 to varasm.c is:
Index: gcc/varasm.c
===================================================================
*** gcc/varasm.c    (revision 208048)
--- gcc/varasm.c    (working copy)
*************** output_constructor_regular_field (oc_loc
*** 4939,4944 ****
--- 4939,4946 ----
           better be last.  */
        gcc_assert (!fieldsize || !DECL_CHAIN (local->field));
      }
+       else if (DECL_SIZE_UNIT (local->field) == NULL_TREE)
+     fieldsize = int_size_in_bytes (TREE_TYPE (local->field));
        else
      fieldsize = tree_to_uhwi (DECL_SIZE_UNIT (local->field));
      }

Clearly, this is bomb-proof and so regtesting proceeds without problem for gcc
and gfortran.

It now remains to understand how structure fields can be built with type size
information but with the decl comon information missing! ie. it should be
possible to render the above unnecessary.

Cheers

Paul

--
You are receiving this mail because:
You are on the CC list for the bug.


  parent reply	other threads:[~2014-02-25 13:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20  2:30 [Bug fortran/59198] New: " juergen.reuter at desy dot de
2013-11-20 14:40 ` [Bug fortran/59198] [4.7/4.8/4.9 Regression] " janus at gcc dot gnu.org
2013-11-20 15:55 ` janus at gcc dot gnu.org
2013-12-19 15:20 ` rguenth at gcc dot gnu.org
2013-12-19 15:33 ` rguenth at gcc dot gnu.org
2014-01-19 21:31 ` mikael at gcc dot gnu.org
2014-02-09 17:50 ` janus at gcc dot gnu.org
2014-02-22 13:35 ` pault at gcc dot gnu.org
2014-02-22 15:35 ` burnus at gcc dot gnu.org
2014-02-22 16:02 ` paul.richard.thomas at gmail dot com
2014-02-24  9:20 ` paul.richard.thomas at gmail dot com
2014-02-25  9:31 ` pault at gcc dot gnu.org
2014-02-25 13:44 ` paul.richard.thomas at gmail dot com [this message]
2014-02-25 20:23 ` pault at gcc dot gnu.org
2014-06-12 13:46 ` [Bug fortran/59198] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org
2014-12-19 13:40 ` [Bug fortran/59198] [4.8/4.9/5 " jakub at gcc dot gnu.org
2014-12-26 15:59 ` paul.richard.thomas at gmail dot com
2014-12-26 16:25 ` dominiq at lps dot ens.fr
2015-02-17  9:39 ` dominiq at lps dot ens.fr
2015-03-16  8:45 ` pault at gcc dot gnu.org
2015-03-16 11:26 ` juergen.reuter at desy dot de
2015-03-17  5:20 ` pault at gcc dot gnu.org
2015-03-18 20:22 ` [Bug fortran/59198] [4.8/4.9 " anlauf at gmx dot de
2015-03-18 21:19 ` pault at gcc dot gnu.org
2015-03-19 22:23 ` pault at gcc dot gnu.org
2015-06-23  8:47 ` [Bug fortran/59198] [4.8 " rguenth 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-59198-4-0Wg6CqWWn3@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).