On 11/21/2011 01:58 PM, Torvald Riegel wrote: > On Mon, 2011-11-21 at 13:45 -0800, Richard Henderson wrote: >> On 11/21/2011 01:39 PM, Torvald Riegel wrote: >>> It still fails when combined >>> with transaction expressions (noexcept-4.C and noexcept-1.C) because >>> gimplify_must_not_throw_expr() calls voidify_wrapper_expr() on a >>> MUST_NOT_THROW_EXPR which it doesn't know to be a wrapper. What's the >>> cleanest way to solve that? Adding handling of MUST_NOT_THROW_EXPR >>> inside voidify_... will include C++ stuff there, right? Or should there >>> be a C++ version of voidify_...? Or something else? >> >> What's happening below gimplify_must_not_throw_expr? >> >> That *ought* to be recursing into voidify_wrapper_expr and >> doing the right thing. > > gimplify_must_not_throw_expr does call voidify_wrapper_expr, with the > assumption that the latter understands that MNTE is a wrapper, and will > change the code contained in the wrapper (so, change the MNTE itself). > I thought about changing voidify_wrapper_expr so that its first argument > is a pointer to a tree, so that one can voidify the contained/inner > stuff even when the caller has already skipped a wrapper (MNTE in our > case). But this didn't seem to be clearer either.
Try this, as discussed with Jason on IRC. r~
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index cfe6696..373687c 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; } }