re PR lto/48954 (ICE: SIGSEGV in bitmap_count_bits (bitmap.c:719) with -O2 -flto...
authorJan Hubicka <jh@suse.cz>
Sat, 4 Jun 2011 16:20:36 +0000 (18:20 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sat, 4 Jun 2011 16:20:36 +0000 (16:20 +0000)
PR lto/48954
* lto-cgraph.c (output_node_opt_summary): Handle NULL skip args bitmaps.
* g++.dg/torture/pr48954.C: New testcase.

From-SVN: r174644

gcc/ChangeLog
gcc/lto-cgraph.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr48954.C [new file with mode: 0644]

index ddfb4f95a1a0e93d5a0806b3f6cd408a657a05e9..5fdd07ca2cfa636d8f557b48ea74372d5c166367 100644 (file)
@@ -1,3 +1,8 @@
+2011-06-04  Jan Hubicka  <jh@suse.cz>
+
+       PR lto/48954
+       * lto-cgraph.c (output_node_opt_summary): Handle NULL skip args bitmaps.
+
 2011-06-04  Jonathan Wakely  <jwakely.gcc@gmail.com>
 
        * doc/invoke.texi: Document -Wdelete-non-virtual-dtor.
index 1d2f92e9d1eea2fd0ffcadba8ce099ab0b13fbe1..3b1115b53f63babf4ac8c89f954fd287bc99ef6e 100644 (file)
@@ -1598,14 +1598,24 @@ output_node_opt_summary (struct output_block *ob,
   int i;
   struct cgraph_edge *e;
 
-  lto_output_uleb128_stream (ob->main_stream,
-                            bitmap_count_bits (node->clone.args_to_skip));
-  EXECUTE_IF_SET_IN_BITMAP (node->clone.args_to_skip, 0, index, bi)
-    lto_output_uleb128_stream (ob->main_stream, index);
-  lto_output_uleb128_stream (ob->main_stream,
-                            bitmap_count_bits (node->clone.combined_args_to_skip));
-  EXECUTE_IF_SET_IN_BITMAP (node->clone.combined_args_to_skip, 0, index, bi)
-    lto_output_uleb128_stream (ob->main_stream, index);
+  if (node->clone.args_to_skip)
+    {
+      lto_output_uleb128_stream (ob->main_stream,
+                                bitmap_count_bits (node->clone.args_to_skip));
+      EXECUTE_IF_SET_IN_BITMAP (node->clone.args_to_skip, 0, index, bi)
+       lto_output_uleb128_stream (ob->main_stream, index);
+    }
+  else
+    lto_output_uleb128_stream (ob->main_stream, 0);
+  if (node->clone.combined_args_to_skip)
+    {
+      lto_output_uleb128_stream (ob->main_stream,
+                                bitmap_count_bits (node->clone.combined_args_to_skip));
+      EXECUTE_IF_SET_IN_BITMAP (node->clone.combined_args_to_skip, 0, index, bi)
+       lto_output_uleb128_stream (ob->main_stream, index);
+    }
+  else
+    lto_output_uleb128_stream (ob->main_stream, 0);
   lto_output_uleb128_stream (ob->main_stream,
                             VEC_length (ipa_replace_map_p, node->clone.tree_map));
   FOR_EACH_VEC_ELT (ipa_replace_map_p, node->clone.tree_map, i, map)
index 30639929fb69d1bad8680f1ba3fdb235526cb8c7..b88637cbddc6dc818326246c6baa91940258fc90 100644 (file)
@@ -1,3 +1,8 @@
+2011-06-04  Jan Hubicka  <jh@suse.cz>
+
+       PR lto/48954
+       * g++.dg/torture/pr48954.C: New testcase.
+
 2011-06-04  Jonathan Wakely  <jwakely.gcc@gmail.com>
 
        * testsuite/g++.dg/warn/delete-non-virtual-dtor.C: New.
diff --git a/gcc/testsuite/g++.dg/torture/pr48954.C b/gcc/testsuite/g++.dg/torture/pr48954.C
new file mode 100644 (file)
index 0000000..1af0328
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -flto -fno-early-inlining -fkeep-inline-functions" } */
+struct A
+{
+  virtual void foo () = 0;
+};
+
+struct B : A {};
+struct C : A {};
+
+struct D: C, B
+{
+  void foo () {}
+};
+
+static inline void
+bar (B *b)
+{
+  b->foo ();
+}
+
+int
+main ()
+{
+  D d;
+  for (;;)
+    bar (&d);
+}