OSDN Git Service

PR c++/28899
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 Sep 2006 17:59:41 +0000 (17:59 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 Sep 2006 17:59:41 +0000 (17:59 +0000)
        * gimplify.c (gimplify_modify_expr_rhs) [BIND_EXPR]: Handle
        want_value.

        * gimplify.c (voidify_wrapper_expr): Handle null type.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116637 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/g++.dg/ext/stmtexpr9.C [new file with mode: 0644]

index 922caa5..242104b 100644 (file)
@@ -1,3 +1,11 @@
+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.
+
 2006-09-01  Josh Conner  <jconner@apple.com>
 
        PR c++/25505
index cf48770..a408c01 100644 (file)
@@ -955,9 +955,9 @@ gimple_build_eh_filter (tree body, tree allowed, tree failure)
 tree
 voidify_wrapper_expr (tree wrapper, tree temp)
 {
-  if (!VOID_TYPE_P (TREE_TYPE (wrapper)))
+  tree type = TREE_TYPE (wrapper);
+  if (type && !VOID_TYPE_P (type))
     {
-      tree type = TREE_TYPE (wrapper);
       tree *p;
 
       /* Set p to point to the body of the wrapper.  Loop until we find
@@ -3415,10 +3415,23 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, tree *pre_p,
       case STATEMENT_LIST:
        {
          tree wrap = *from_p;
-         tree t = voidify_wrapper_expr (wrap, *expr_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);
 
-         *expr_p = wrap;
+         if (want_value)
+           {
+             gimplify_and_add (wrap, pre_p);
+             *expr_p = unshare_expr (*to_p);
+           }
+         else
+           *expr_p = wrap;
          return GS_OK;
        }
        
diff --git a/gcc/testsuite/g++.dg/ext/stmtexpr9.C b/gcc/testsuite/g++.dg/ext/stmtexpr9.C
new file mode 100644 (file)
index 0000000..4963e10
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/28899
+// { dg-options "" }
+
+void f()
+{
+  unsigned l, l1;
+  l1 = l = ({ unsigned __v; __v; });
+}