diff options
author | Jakub Jelinek <jakub@redhat.com> | 2001-10-19 21:28:03 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2001-10-19 21:28:03 +0200 |
commit | 4768dbddcd8b626899574a5d10651e68d27f9328 (patch) | |
tree | 3cdc907694d60933dafc3af4b4dd4296d6a692a8 | |
parent | c5adc06afa348edfb16727209b685707d4daa9ad (diff) | |
download | gcc-4768dbddcd8b626899574a5d10651e68d27f9328.zip gcc-4768dbddcd8b626899574a5d10651e68d27f9328.tar.gz gcc-4768dbddcd8b626899574a5d10651e68d27f9328.tar.bz2 |
simplify-rtx.c (simplify_plus_minus): Negate constant iff its neg field is different to previous argument's neg field.
* simplify-rtx.c (simplify_plus_minus): Negate constant iff its neg
field is different to previous argument's neg field.
* gcc.c-torture/execute/20011019-1.c: New test.
From-SVN: r46356
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/simplify-rtx.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/20011019-1.c | 18 |
4 files changed, 28 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 30b3685..7a8155b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-10-19 Jakub Jelinek <jakub@redhat.com> + + * simplify-rtx.c (simplify_plus_minus): Negate constant iff its neg + field is different to previous argument's neg field. + Fri Oct 19 15:24:39 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> * final.c (get_decl_from_op): New function. diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 2b7e3a2..bdeb265 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -1882,7 +1882,7 @@ simplify_plus_minus (code, mode, op0, op1) && CONSTANT_P (ops[n_ops - 2].op)) { HOST_WIDE_INT value = INTVAL (ops[n_ops - 1].op); - if (ops[n_ops - 1].neg) + if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg) value = -value; ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, value); n_ops--; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 114fc4a..a59720d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2001-10-19 Jakub Jelinek <jakub@redhat.com> + + * gcc.c-torture/execute/20011019-1.c: New test. + 2001-10-19 NIIBE Yutaka <gniibe@m17n.org> * gcc.c-torture/execute/ieee/ieee.exp: Change sh-*-* to sh*-*-*. diff --git a/gcc/testsuite/gcc.c-torture/execute/20011019-1.c b/gcc/testsuite/gcc.c-torture/execute/20011019-1.c new file mode 100644 index 0000000..ebaa411 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20011019-1.c @@ -0,0 +1,18 @@ +extern void exit (int); +extern void abort (void); + +struct { int a; int b[5]; } x; +int *y; + +int foo (void) +{ + return y - x.b; +} + +int main (void) +{ + y = x.b; + if (foo ()) + abort (); + exit (0); +} |