This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH to gimplify_modify_expr_rhs for c++/28899
- From: Jason Merrill <jason at redhat dot com>
- To: "gcc-patches >> GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 01 Sep 2006 13:59:25 -0400
- Subject: PATCH to gimplify_modify_expr_rhs for c++/28899
In my patch for PR 27715 I failed to allow for using the value of an
assignment from a statement-expression. Fixed thus.
Tested x86_64-pc-linux-gnu, applied to trunk.
2006-09-01 Jason Merrill <jason@redhat.com>
PR c++/28899
* gimplify.c (gimplify_modify_expr_rhs) [BIND_EXPR]: Handle
want_value.
* gimplify.c (voidify_wrapper_expr): Handle null type.
Index: gimplify.c
===================================================================
*** gimplify.c (revision 116635)
--- gimplify.c (working copy)
*************** gimple_build_eh_filter (tree body, tree
*** 955,963 ****
tree
voidify_wrapper_expr (tree wrapper, tree temp)
{
! if (!VOID_TYPE_P (TREE_TYPE (wrapper)))
{
- tree type = TREE_TYPE (wrapper);
tree *p;
/* Set p to point to the body of the wrapper. Loop until we find
--- 955,963 ----
tree
voidify_wrapper_expr (tree wrapper, tree temp)
{
! tree type = TREE_TYPE (wrapper);
! if (type && !VOID_TYPE_P (type))
{
tree *p;
/* Set p to point to the body of the wrapper. Loop until we find
*************** gimplify_modify_expr_rhs (tree *expr_p,
*** 3415,3424 ****
case STATEMENT_LIST:
{
tree wrap = *from_p;
! tree t = voidify_wrapper_expr (wrap, *expr_p);
gcc_assert (t == *expr_p);
! *expr_p = wrap;
return GS_OK;
}
--- 3415,3437 ----
case STATEMENT_LIST:
{
tree wrap = *from_p;
! tree t;
!
! ret = gimplify_expr (to_p, pre_p, post_p,
! is_gimple_min_lval, fb_lvalue);
! if (ret != GS_ERROR)
! ret = GS_OK;
!
! t = voidify_wrapper_expr (wrap, *expr_p);
gcc_assert (t == *expr_p);
! if (want_value)
! {
! gimplify_and_add (wrap, pre_p);
! *expr_p = unshare_expr (*to_p);
! }
! else
! *expr_p = wrap;
return GS_OK;
}
Index: testsuite/g++.dg/ext/stmtexpr9.C
===================================================================
*** testsuite/g++.dg/ext/stmtexpr9.C (revision 0)
--- testsuite/g++.dg/ext/stmtexpr9.C (revision 0)
***************
*** 0 ****
--- 1,8 ----
+ // PR c++/28899
+ // { dg-options "" }
+
+ void f()
+ {
+ unsigned l, l1;
+ l1 = l = ({ unsigned __v; __v; });
+ }