aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-08-19 14:25:45 -0400
committerJason Merrill <jason@gcc.gnu.org>2014-08-19 14:25:45 -0400
commit27093ee4fc85ceb883cefc4f572ce4d4a9b68131 (patch)
tree56892d19137aa0a96badc189ed7f577a12b9794f /gcc/cp
parent981ac3c795ed23053c0a82d01d8d3158429a547f (diff)
downloadgcc-27093ee4fc85ceb883cefc4f572ce4d4a9b68131.zip
gcc-27093ee4fc85ceb883cefc4f572ce4d4a9b68131.tar.gz
gcc-27093ee4fc85ceb883cefc4f572ce4d4a9b68131.tar.bz2
re PR tree-optimization/62091 (ice in before_dom_children)
PR tree-optimization/62091 * decl2.c (decl_needed_p): Return true for virtual functions when devirtualizing. From-SVN: r214181
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/decl2.c5
2 files changed, 9 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c60682e..26599c2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2014-08-19 Jason Merrill <jason@redhat.com>
+ PR tree-optimization/62091
+ * decl2.c (decl_needed_p): Return true for virtual functions when
+ devirtualizing.
+
PR lto/53808
PR c++/61659
* decl.c (maybe_commonize_var): Don't use DECL_COMDAT to trigger
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index de28cb7..63583a8 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1975,6 +1975,11 @@ decl_needed_p (tree decl)
if (flag_keep_inline_dllexport
&& lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)))
return true;
+ /* Virtual functions might be needed for devirtualization. */
+ if (flag_devirtualize
+ && TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_VIRTUAL_P (decl))
+ return true;
/* Otherwise, DECL does not need to be emitted -- yet. A subsequent
reference to DECL might cause it to be emitted later. */
return false;