aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-12-20 19:13:56 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2012-12-20 19:13:56 +0100
commitd97c9b2248a86fc8a2d3f65df0e0a63347c89e2a (patch)
tree59a1a32f0ecc1e856d08b15d3921d000019c27c2 /gcc
parent5bb339361a483eca12853be5729b7b1ad12ed3dd (diff)
downloadgcc-d97c9b2248a86fc8a2d3f65df0e0a63347c89e2a.zip
gcc-d97c9b2248a86fc8a2d3f65df0e0a63347c89e2a.tar.gz
gcc-d97c9b2248a86fc8a2d3f65df0e0a63347c89e2a.tar.bz2
re PR middle-end/55750 (-( in expand_expr_addr_expr_1, at expr.c:7646)
PR middle-end/55750 * gimplify.c (gimplify_self_mod_expr): Don't force lvalue to pass is_gimple_min_lval. * gcc.c-torture/execute/pr55750.c: New test. From-SVN: r194647
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/gimplify.c16
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr55750.c29
4 files changed, 43 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1fb596f..9e7a4b7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2012-12-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/55750
+ * gimplify.c (gimplify_self_mod_expr): Don't force lvalue to
+ pass is_gimple_min_lval.
+
2012-12-20 Richard Henderson <rth@redhat.com>
Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index f628b8a..e79d063 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -2391,25 +2391,15 @@ gimplify_self_mod_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
rhs = TREE_OPERAND (*expr_p, 1);
/* For postfix operator, we evaluate the LHS to an rvalue and then use
- that as the result value and in the postqueue operation. We also
- make sure to make lvalue a minimal lval, see
- gcc.c-torture/execute/20040313-1.c for an example where this matters. */
+ that as the result value and in the postqueue operation. */
if (postfix)
{
- if (!is_gimple_min_lval (lvalue))
- {
- mark_addressable (lvalue);
- lvalue = build_fold_addr_expr_loc (input_location, lvalue);
- gimplify_expr (&lvalue, pre_p, post_p, is_gimple_val, fb_rvalue);
- lvalue = build_fold_indirect_ref_loc (input_location, lvalue);
- }
ret = gimplify_expr (&lhs, pre_p, post_p, is_gimple_val, fb_rvalue);
if (ret == GS_ERROR)
return ret;
- }
- if (postfix)
- lhs = get_initialized_tmp_var (lhs, pre_p, NULL);
+ lhs = get_initialized_tmp_var (lhs, pre_p, NULL);
+ }
/* For POINTERs increment, use POINTER_PLUS_EXPR. */
if (POINTER_TYPE_P (TREE_TYPE (lhs)))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c7cb233..b89fa02 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/55750
+ * gcc.c-torture/execute/pr55750.c: New test.
+
2012-12-20 Richard Biener <rguenther@suse.de>
PR middle-end/55740
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr55750.c b/gcc/testsuite/gcc.c-torture/execute/pr55750.c
new file mode 100644
index 0000000..d2b3c63
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr55750.c
@@ -0,0 +1,29 @@
+/* PR middle-end/55750 */
+
+extern void abort (void);
+
+struct S
+{
+ int m : 1;
+ int n : 7;
+} arr[2];
+
+__attribute__((noinline, noclone)) void
+foo (unsigned i)
+{
+ arr[i].n++;
+}
+
+int
+main ()
+{
+ arr[0].m = -1;
+ arr[0].n = (1 << 6) - 1;
+ arr[1].m = 0;
+ arr[1].n = -1;
+ foo (0);
+ foo (1);
+ if (arr[0].m != -1 || arr[0].n != -(1 << 6) || arr[1].m != 0 || arr[1].n != 0)
+ abort ();
+ return 0;
+}