aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2001-09-03 22:54:02 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2001-09-03 22:54:02 +0200
commit7743fdb993f4468e0f47fdff3f2db3c64fd344f6 (patch)
tree35937a1c5c5f364f636d2e54402f067733715527
parent964be02f4434ee0244a69dcaf345e46ab36100d2 (diff)
downloadgcc-7743fdb993f4468e0f47fdff3f2db3c64fd344f6.zip
gcc-7743fdb993f4468e0f47fdff3f2db3c64fd344f6.tar.gz
gcc-7743fdb993f4468e0f47fdff3f2db3c64fd344f6.tar.bz2
loop.c (express_from_1): Fix CONSTANT_P(a) case.
* loop.c (express_from_1): Fix CONSTANT_P(a) case. * gcc.c-torture/compile/20010903-1.c: New test. From-SVN: r45365
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/loop.c2
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20010903-1.c28
4 files changed, 37 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 312b2e0..a7ce66e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2001-09-03 Jakub Jelinek <jakub@redhat.com>
+
+ * loop.c (express_from_1): Fix CONSTANT_P(a) case.
+
2001-09-03 Richard Henderson <rth@redhat.com>
* function.h (struct function): Add arg_pointer_save_area_init.
diff --git a/gcc/loop.c b/gcc/loop.c
index 5fbe667..e72f421 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -6371,7 +6371,7 @@ express_from_1 (a, b, mult)
}
else if (CONSTANT_P (a))
{
- return simplify_gen_binary (MINUS, GET_MODE (b) != VOIDmode ? GET_MODE (b) : GET_MODE (a), const0_rtx, a);
+ return simplify_gen_binary (MINUS, GET_MODE (b) != VOIDmode ? GET_MODE (b) : GET_MODE (a), b, a);
}
else if (GET_CODE (b) == PLUS)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 405b0e0..b76142b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2001-09-03 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.c-torture/compile/20010903-1.c: New test.
+
2001-08-31 Roman Zippel <zippel@linux-m68k.org>
* testsuite/gcc.c-torture/execute/ieee/ieee.exp: Add -ffloat-store
diff --git a/gcc/testsuite/gcc.c-torture/compile/20010903-1.c b/gcc/testsuite/gcc.c-torture/compile/20010903-1.c
new file mode 100644
index 0000000..8e519f2
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20010903-1.c
@@ -0,0 +1,28 @@
+struct A {
+ long a;
+};
+
+static inline void foo(struct A *x)
+{
+ __asm__ __volatile__("" : "+m"(x->a) : "r"(x) : "memory", "cc");
+}
+
+static inline void bar(struct A *x)
+{
+ foo(x);
+}
+
+struct B { char buf[640]; struct A a; };
+struct B b[32];
+
+int baz(void)
+{
+ int i;
+ struct B *j;
+ for (i = 1; i < 32; i++)
+ {
+ j = &b[i];
+ bar(&j->a);
+ }
+ return 0;
+}