[Bug c++/81007] [7/8 Regression] ICE with virtual function in broken class

2017-06-09 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81007

--- Comment #3 from Richard Biener  ---
Author: rguenth
Date: Fri Jun  9 09:35:05 2017
New Revision: 249051

URL: https://gcc.gnu.org/viewcvs?rev=249051=gcc=rev
Log:
2017-06-09  Richard Biener  

PR middle-end/81007
* ipa-polymorphic-call.c
(ipa_polymorphic_call_context::restrict_to_inner_class):
Skip FIELD_DECLs with error_mark_node type.
* passes.def (all_lowering_passes): Run pass_build_cgraph_edges
last again.

* g++.dg/pr81007.C: New testcase.

Added:
trunk/gcc/testsuite/g++.dg/pr81007.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/ipa-polymorphic-call.c
trunk/gcc/passes.def
trunk/gcc/testsuite/ChangeLog

[Bug c++/81007] [7/8 Regression] ICE with virtual function in broken class

2017-06-08 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81007

Richard Biener  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org

--- Comment #2 from Richard Biener  ---
(gdb) p debug_tree (field)
 
nonlocal VOID file t.ii line 3 col 5
align 1 offset_align 1 context  chain
>
(gdb) up
#5  0x00edadbd in ipa_polymorphic_call_context::restrict_to_inner_class
(this=0x7fffcca0, otr_type=, 
consider_placement_new=false, consider_bases=false)
at /space/rguenther/src/svn/early-lto-debug/gcc/ipa-polymorphic-call.c:273
273   pos = int_bit_position (fld);
(gdb) l
268   for (fld = TYPE_FIELDS (type); fld; fld = DECL_CHAIN (fld))
269 {
270   if (TREE_CODE (fld) != FIELD_DECL)
271 continue;
272
273   pos = int_bit_position (fld);

I don't think we should try to deal with error stuff in optimization so...

Index: gcc/gimplify.c
===
--- gcc/gimplify.c  (revision 249003)
+++ gcc/gimplify.c  (working copy)
@@ -3067,6 +3067,10 @@ gimplify_arg (tree *arg_p, gimple_seq *p
 static bool
 maybe_fold_stmt (gimple_stmt_iterator *gsi)
 {
+  /* Do not fold if we may have invalid IL somewhere.  */
+  if (seen_error ())
+return false;
+
   struct gimplify_omp_ctx *ctx;
   for (ctx = gimplify_omp_ctxp; ctx; ctx = ctx->outer_context)
 if ((ctx->region_type & (ORT_TARGET | ORT_PARALLEL | ORT_TASK)) != 0)

which delays the ICE until cgraphbuild...  (pass_build_cgraph_edges).  So ...

Index: gcc/cgraphbuild.c
===
--- gcc/cgraphbuild.c   (revision 249003)
+++ gcc/cgraphbuild.c   (working copy)
@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3.
 #include "gimple-walk.h"
 #include "ipa-utils.h"
 #include "except.h"
+#include "diagnostic-core.h"

 /* Context of record_reference.  */
 struct record_reference_ctx
@@ -305,6 +306,7 @@ public:
   /* opt_pass methods: */
   virtual unsigned int execute (function *);

+  virtual bool gate (function *) { return ! seen_error (); }
 }; // class pass_build_cgraph_edges

 unsigned int

[Bug c++/81007] [7/8 Regression] ICE with virtual function in broken class

2017-06-08 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81007

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-06-08
 CC||marxin at gcc dot gnu.org,
   ||rguenth at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Martin Liška  ---
Started with r235817.

[Bug c++/81007] [7/8 Regression] ICE with virtual function in broken class

2017-06-08 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81007

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P4
   Target Milestone|--- |7.2