From 5f23640f57cdd908c105b366dda7db7048dc62ef Mon Sep 17 00:00:00 2001
From: Torvald Riegel <triegel@redhat.com>
Date: Mon, 12 Dec 2011 12:05:01 +0000
Subject: [PATCH] Add default handling for outermost wrappers in
 voidify_wrapper_expr.

	gcc/
	* gimplify.c (voidify_wrapper_expr): Add default handling for
	outermost wrapper.

From-SVN: r182232
---
 gcc/ChangeLog  | 5 +++++
 gcc/gimplify.c | 9 +++++++++
 2 files changed, 14 insertions(+)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index eed29f04cce5..17be451977da 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-12  Torvald Riegel  <triegel@redhat.com>
+
+	* gimplify.c (voidify_wrapper_expr): Add default handling for
+	outermost wrapper.
+
 2011-12-12  Torvald Riegel  <triegel@redhat.com>
 
 	* tree-ssa-tail-merge.c (gimple_equal_p): Don't treat transaction
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index f548e7033905..fe8d2f801a35 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1081,6 +1081,15 @@ voidify_wrapper_expr (tree wrapper, tree temp)
 	      break;
 
 	    default:
+	      /* Assume that any tree upon which voidify_wrapper_expr is
+		 directly called is a wrapper, and that its body is op0.  */
+	      if (p == &wrapper)
+		{
+		  TREE_SIDE_EFFECTS (*p) = 1;
+		  TREE_TYPE (*p) = void_type_node;
+		  p = &TREE_OPERAND (*p, 0);
+		  break;
+		}
 	      goto out;
 	    }
 	}
-- 
GitLab