This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/29154] [4.0/4.1/4.2 Regression] *(* ppointer++)++ = *pointer++ generates bad code



------- Comment #3 from jakub at gcc dot gnu dot org  2006-09-22 20:25 -------
I wonder if we just shouldn't ensure that for postfix exprs post_p statements
of the inner expression are put after, not before the +=/-=.
Something like:
--- gimplify.c.jj2      2006-09-02 08:47:25.000000000 +0200
+++ gimplify.c  2006-09-22 22:21:29.000000000 +0200
@@ -1896,7 +1896,7 @@ gimplify_self_mod_expr (tree *expr_p, tr
                        bool want_value)
 {
   enum tree_code code;
-  tree lhs, lvalue, rhs, t1;
+  tree lhs, lvalue, rhs, t1, post = NULL, *orig_post_p = post_p;
   bool postfix;
   enum tree_code arith_code;
   enum gimplify_status ret;
@@ -1913,6 +1913,9 @@ gimplify_self_mod_expr (tree *expr_p, tr
   else
     postfix = false;

+  if (postfix)
+    post_p = &post;
+
   /* Add or subtract?  */
   if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR)
     arith_code = PLUS_EXPR;
@@ -1943,7 +1946,8 @@ gimplify_self_mod_expr (tree *expr_p, tr

   if (postfix)
     {
-      gimplify_and_add (t1, post_p);
+      gimplify_and_add (t1, orig_post_p);
+      append_to_statement_list (post, orig_post_p);
       *expr_p = lhs;
       return GS_ALL_DONE;
     }


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dnovillo at redhat dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29154


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]