public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hubicka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/58585] [4.9 Regression] ICE in ipa with virtual inheritance
Date: Fri, 10 Jan 2014 13:21:00 -0000	[thread overview]
Message-ID: <bug-58585-4-xotidkN2h4@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-58585-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #20 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Looking even deeper, there are two problems.  The first is that we miss C in
type hiearchy graph.

C however may be defined in other unit. We do mistake already while walking B. 
There are two variants of B::foo.  One when base A is non-virtual and other
when it is virtual.

B's vtable is:
_ZTV1C: 
        .quad   0
        .quad   8
        .quad   8
        .quad   0
        .quad   _ZTI1C
        .quad   _ZTv0_n24_N1B3fooEv
        .quad   -8
        .quad   0
        .quad   -8
        .quad   _ZTI1C
        .quad   _ZN1B3fooEv

Our walking logic misses the fact that descendands of B may use the thunk
instead of FOO based on presence of virtual inheritance.

I suppose for complete correctness I would have to add code associating methods
with their virtual thunks and lookup the thunks when walking B and knowng that
I am interested in the derived types.

Simpler solution solving both problems practically is probably to simply walk
known vtables and insert their types to the type hiearchy: all internal
devirtualizations will be correct and all the missed calls to thunk from vtable
of type defined externally are harmless: the visibility code already makes all
the assumption that the call can happen.


  parent reply	other threads:[~2014-01-10 13:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-30 21:50 [Bug middle-end/58585] New: " reichelt at gcc dot gnu.org
2013-10-02 15:48 ` [Bug middle-end/58585] " hubicka at gcc dot gnu.org
2013-10-03 15:52 ` hubicka at gcc dot gnu.org
2013-10-03 16:11 ` hubicka at gcc dot gnu.org
2013-10-03 21:46 ` hubicka at ucw dot cz
2013-10-04  1:50 ` jason at gcc dot gnu.org
2013-10-04 10:33 ` hubicka at ucw dot cz
2013-11-05 14:46 ` rguenth at gcc dot gnu.org
2013-12-06 11:29 ` octoploid at yandex dot com
2013-12-15 20:50 ` hubicka at gcc dot gnu.org
2014-01-07  9:09 ` hubicka at gcc dot gnu.org
2014-01-07  9:34 ` hubicka at gcc dot gnu.org
2014-01-07 10:50 ` trippels at gcc dot gnu.org
2014-01-07 11:07 ` trippels at gcc dot gnu.org
2014-01-07 13:07 ` hubicka at ucw dot cz
2014-01-07 17:31 ` hubicka at gcc dot gnu.org
2014-01-08 17:41 ` hubicka at gcc dot gnu.org
2014-01-08 17:53 ` trippels at gcc dot gnu.org
2014-01-10  9:40 ` hubicka at gcc dot gnu.org
2014-01-10 13:21 ` hubicka at gcc dot gnu.org [this message]
2014-01-10 21:35 ` hubicka at gcc dot gnu.org
2014-01-11 11:01 ` hubicka 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-58585-4-xotidkN2h4@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).