This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/29154] [4.0/4.1/4.2 Regression] *(* ppointer++)++ = *pointer++ generates bad code
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Sep 2006 20:25:31 -0000
- Subject: [Bug c/29154] [4.0/4.1/4.2 Regression] *(* ppointer++)++ = *pointer++ generates bad code
- References: <bug-29154-13237@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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