[pph] Fix check for empty statement list (issue5905065)

Diego Novillo dnovillo@google.com
Mon Mar 26 16:11:00 GMT 2012


Fix check for empty statement list.

We do some sanity checks before starting to write a PPH image.  The
check was inconsistent: for the VEC scope_chain->x_stmt_tree.x_cur_stmt_list
we were asserting that it was NULL *and* empty.

We just need it to be empty.  It doesn't matter if it was allocated.

2012-03-25   Diego Novillo  <dnovillo@google.com>

	* pph-out.c (pph_out_global_binding_keys): Fix check for empty
	statement list.
---
 gcc/cp/ChangeLog.pph |    5 +++++
 gcc/cp/pph-out.c     |    3 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/ChangeLog.pph b/gcc/cp/ChangeLog.pph
index 1cf90b4..f5b8281 100644
--- a/gcc/cp/ChangeLog.pph
+++ b/gcc/cp/ChangeLog.pph
@@ -1,5 +1,10 @@
 2012-03-25   Diego Novillo  <dnovillo@google.com>
 
+	* pph-out.c (pph_out_global_binding_keys): Fix check for empty
+	statement list.
+
+2012-03-25   Diego Novillo  <dnovillo@google.com>
+
 	* mangle.c (write_expression): Handle TRAIT_EXPR when PPH is enabled.
 	(write_template_arg_literal): Handle CONST_DECLs that do not have
 	a constant DECL_INITIAL when PPH is enabled.
diff --git a/gcc/cp/pph-out.c b/gcc/cp/pph-out.c
index 7ba4ee6..1efac6b 100644
--- a/gcc/cp/pph-out.c
+++ b/gcc/cp/pph-out.c
@@ -2604,8 +2604,7 @@ pph_out_global_binding_keys (pph_stream *stream)
 		   || scope_chain->x_processing_template_decl
 		   || scope_chain->x_processing_specialization
 		   || scope_chain->x_processing_explicit_instantiation
-		   || scope_chain->need_pop_function_context
-		   || scope_chain->x_stmt_tree.x_cur_stmt_list)
+		   || scope_chain->need_pop_function_context)
 	      && VEC_empty (tree, scope_chain->x_stmt_tree.x_cur_stmt_list));
 
   /* We need to write a record for BL before emitting the merge keys
-- 
1.7.7.3


--
This patch is available for review at http://codereview.appspot.com/5905065



More information about the Gcc-patches mailing list