From 26740835ec4e0049bf26b98cea017e1d9ce888b0 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sat, 4 Jun 2011 18:20:36 +0200 Subject: [PATCH] re PR lto/48954 (ICE: SIGSEGV in bitmap_count_bits (bitmap.c:719) with -O2 -flto -fno-early-inlining -fkeep-inline-functions) 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 | 5 +++++ gcc/lto-cgraph.c | 26 ++++++++++++++++-------- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/torture/pr48954.C | 28 ++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/g++.dg/torture/pr48954.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ddfb4f95a1a..5fdd07ca2cf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-06-04 Jan Hubicka + + PR lto/48954 + * lto-cgraph.c (output_node_opt_summary): Handle NULL skip args bitmaps. + 2011-06-04 Jonathan Wakely * doc/invoke.texi: Document -Wdelete-non-virtual-dtor. diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index 1d2f92e9d1e..3b1115b53f6 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 30639929fb6..b88637cbddc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-06-04 Jan Hubicka + + PR lto/48954 + * g++.dg/torture/pr48954.C: New testcase. + 2011-06-04 Jonathan Wakely * 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 index 00000000000..1af03289b24 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr48954.C @@ -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); +} -- 2.30.2