From: Gabriel Dos Reis Date: Sat, 13 Mar 2004 03:03:38 +0000 (+0000) Subject: backport: re PR tree-optimization/14470 ([tree-ssa] trouble with post-increment) X-Git-Tag: releases/gcc-3.3.4~164 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba6dd3ea30c71f8860af327d3d7b6f3e06bc6f0b;p=thirdparty%2Fgcc.git backport: re PR tree-optimization/14470 ([tree-ssa] trouble with post-increment) Backport: 2004-03-09 Eric Botcazou PR middle-end/14470 * expr.c (store_expr): Call emit_queue before generating the move from the temporary to the original target. Protect the temporary from emit_queue. From-SVN: r79429 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 26fda29fb639..6bd8b81374ef 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2004-03-12 Gabriel Dos Reis + + Backport: + 2004-03-09 Eric Botcazou + PR middle-end/14470 + * expr.c (store_expr): Call emit_queue before generating the move + from the temporary to the original target. Protect the temporary + from emit_queue. + 2004-03-10 James E Wilson PR target/13877 diff --git a/gcc/expr.c b/gcc/expr.c index c239ac96855d..f3a6f1ea88ba 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -4552,7 +4552,9 @@ store_expr (exp, target, want_value) bit-initialized. */ && expr_size (exp) != const0_rtx) { + emit_queue (); target = protect_from_queue (target, 1); + temp = protect_from_queue (temp, 0); if (GET_MODE (temp) != GET_MODE (target) && GET_MODE (temp) != VOIDmode) { diff --git a/gcc/testsuite/gcc.c-torture/execute/20040309-1.c b/gcc/testsuite/gcc.c-torture/execute/20040309-1.c index 49fa79560c60..d52532d6b444 100644 --- a/gcc/testsuite/gcc.c-torture/execute/20040309-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/20040309-1.c @@ -1,24 +1,16 @@ -extern void abort (); +/* PR middle-end/14470 */ +/* Origin: Lodewijk Voge */ -int foo(unsigned short x) -{ - unsigned short y; - y = x > 32767 ? x - 32768 : 0; - return y; -} +extern void abort(void); int main() { - if (foo (0) != 0) - abort (); - if (foo (32767) != 0) - abort (); - if (foo (32768) != 0) - abort (); - if (foo (32769) != 1) - abort (); - if (foo (65535) != 32767) - abort (); + int t[1025] = { 1024 }, d; + + d = 0; + d = t[d]++; + if (t[0] != 1025) + abort(); return 0; }