From: Diego Novillo <dnovillo@redhat.com>
To: gcc-patches@gcc.gnu.org, Mark Mitchell <mark@codesourcery.com>
Subject: PR 29585: C++ front end not setting TREE_ADDRESSABLE on vtbl entries
Date: Sat, 31 Mar 2007 19:50:00 -0000 [thread overview]
Message-ID: <460EA260.3000404@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1277 bytes --]
As discussed in http://gcc.gnu.org/ml/gcc/2007-03/msg01153.html, the C++
front end is building ADDR_EXPRs for vtbl entries but is not setting
TREE_ADDRESSABLE consistently.
This is causing the setup routines in alias analysis to ignore these
variables. But during analysis, we add them to points-to and alias
sets. Since the variables had been initially ignored, they don't get
marked for renaming, causing an ICE during conversion to SSA.
The approach I tried initially is to make the aliaser very strict in
asserting the addressability of every symbol added to an alias set.
This uncovers various inconsistencies in C, C++ and Java FEs. So, the
idea is to make everything consistent by forcing build1() to set
TREE_ADDRESSABLE every time it's asked to build ADDR_EXPR. This caused
some controversy, so I will not attempt that on 4.2.
The minimal fix that I found for 4.2 is along the lines of what Mark and
Jason suggested. I did have to try a variation of Mark's suggestion of
building a NOP_EXPR in dfs_accumulate_vtbl_inits, because that was
causing ICEs elsewhere in other functions not expecting a NOP_EXPR.
Bootstrapped on i686, x86_64, ppc64 and ia64.
OK for 4.2? For 4.3 I will use the sane approach of forcing
TREE_ADDRESSABLE for every ADDR_EXPR built.
[-- Attachment #2: 20070330-29585.diff --]
[-- Type: text/x-patch, Size: 1274 bytes --]
2007-03-30 Diego Novillo <dnovillo@redhat.com>
Mark Mitchell <mark@codesourcery.com>
PR 29585
* class.c (dfs_accumulate_vtbl_inits): Use build_address
to build the vtbl entry.
testsuite/ChangeLog
PR 29585
* g++.dg/tree-ssa/pr29585.C: New test.
Index: testsuite/g++.dg/tree-ssa/pr29585.C
===================================================================
--- testsuite/g++.dg/tree-ssa/pr29585.C (revision 0)
+++ testsuite/g++.dg/tree-ssa/pr29585.C (revision 0)
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+class ios_base{};
+struct basic_ostream : virtual ios_base{};
+namespace
+{
+ struct Nullostream : basic_ostream{};
+}
+class In
+{
+ In ();
+ Nullostream nullout;
+};
+In::In (){}
Index: cp/class.c
===================================================================
--- cp/class.c (revision 123332)
+++ cp/class.c (working copy)
@@ -7101,7 +7101,7 @@ dfs_accumulate_vtbl_inits (tree binfo,
/* Figure out the position to which the VPTR should point. */
vtbl = TREE_PURPOSE (l);
- vtbl = build1 (ADDR_EXPR, vtbl_ptr_type_node, vtbl);
+ vtbl = build_address (vtbl);
index = size_binop (PLUS_EXPR,
size_int (non_fn_entries),
size_int (list_length (TREE_VALUE (l))));
next reply other threads:[~2007-03-31 18:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-31 19:50 Diego Novillo [this message]
2007-03-31 20:01 ` Mark Mitchell
2007-04-05 2:02 ` Mike Stump
2007-04-11 1:06 ` Mike Stump
2007-04-11 1:13 ` Mark Mitchell
2007-04-11 2:02 ` Mike Stump
2007-04-11 2:18 ` Mark Mitchell
2007-04-12 1:58 ` Mike Stump
2007-04-12 3:50 ` Mark Mitchell
2007-04-11 1:15 ` Eric Christopher
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=460EA260.3000404@redhat.com \
--to=dnovillo@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=mark@codesourcery.com \
/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).