re PR ipa/81007 (ICE with virtual function in broken class)
authorRichard Biener <rguenther@suse.de>
Fri, 9 Jun 2017 09:35:05 +0000 (09:35 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 9 Jun 2017 09:35:05 +0000 (09:35 +0000)
2017-06-09  Richard Biener  <rguenther@suse.de>

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.

From-SVN: r249051

gcc/ChangeLog
gcc/ipa-polymorphic-call.c
gcc/passes.def
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr81007.C [new file with mode: 0644]

index d61dc3e6ef7a0213d23ce069e8deb2b2e2739826..39902009ade0b0373cad268fb140d97a1ee1d0e1 100644 (file)
@@ -1,3 +1,12 @@
+2017-06-09  Richard Biener  <rguenther@suse.de>
+
+       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.
+
 2017-06-09  Martin Liska  <mliska@suse.cz>
 
        * predict.c (struct branch_predictor): New struct.
index abbcfbf5adaa79989da83e61a825e4993d7df7e5..6b9f82138dc3db4b21c015d680964d39be127416 100644 (file)
@@ -267,7 +267,8 @@ ipa_polymorphic_call_context::restrict_to_inner_class (tree otr_type,
        {
          for (fld = TYPE_FIELDS (type); fld; fld = DECL_CHAIN (fld))
            {
-             if (TREE_CODE (fld) != FIELD_DECL)
+             if (TREE_CODE (fld) != FIELD_DECL
+                 || TREE_TYPE (fld) == error_mark_node)
                continue;
 
              pos = int_bit_position (fld);
index beb350be3a67d0656b200712c4d5af558987dab4..25e9d974bc8f44185063f8c9297431d467f7c94e 100644 (file)
@@ -42,9 +42,9 @@ along with GCC; see the file COPYING3.  If not see
   NEXT_PASS (pass_build_cfg);
   NEXT_PASS (pass_warn_function_return);
   NEXT_PASS (pass_expand_omp);
-  NEXT_PASS (pass_build_cgraph_edges);
   NEXT_PASS (pass_sprintf_length, false);
   NEXT_PASS (pass_walloca, /*strict_mode_p=*/true);
+  NEXT_PASS (pass_build_cgraph_edges);
   TERMINATE_PASS_LIST (all_lowering_passes)
 
   /* Interprocedural optimization passes.  */
index 4c577de2fdd7c6646cd6920b3655bd77b2e23771..c661a14512864ac1d62df6e4b87f2fcaa744f742 100644 (file)
@@ -1,3 +1,8 @@
+2017-06-09  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/81007
+       * g++.dg/pr81007.C: New testcase.
+
 2017-06-09  Jakub Jelinek  <jakub@redhat.com>
 
        * gcc.target/i386/mpx/hard-reg-1-nov.c (mpx_test): Use "esp"
diff --git a/gcc/testsuite/g++.dg/pr81007.C b/gcc/testsuite/g++.dg/pr81007.C
new file mode 100644 (file)
index 0000000..87d7d40
--- /dev/null
@@ -0,0 +1,15 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+struct A
+{
+  A p; // { dg-error "incomplete" }
+  virtual void foo();
+};
+
+struct B : A {};
+
+void bar(B& b)
+{
+  b.foo();
+}