]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
loop.c (express_from_1): Fix CONSTANT_P(a) case.
authorJakub Jelinek <jakub@redhat.com>
Mon, 3 Sep 2001 20:54:02 +0000 (22:54 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 3 Sep 2001 20:54:02 +0000 (22:54 +0200)
* loop.c (express_from_1): Fix CONSTANT_P(a) case.

* gcc.c-torture/compile/20010903-1.c: New test.

From-SVN: r45365

gcc/ChangeLog
gcc/loop.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20010903-1.c [new file with mode: 0644]

index 312b2e069c461be0171a71ad46f00ce26427909c..a7ce66e57512886f02ca3245ab64b0a927dae1dd 100644 (file)
@@ -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.
index 5fbe6670f71a50d6cf6df76012d3aaec4e4778e7..e72f421b8cc0fbf634973de8f0d1a8489b545cf2 100644 (file)
@@ -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)
     {
index 405b0e0d63cc7afa190e246943ac16c49600de04..b76142b975259d841fd47f9a4c5003d2ed67a58c 100644 (file)
@@ -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 (file)
index 0000000..8e519f2
--- /dev/null
@@ -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;
+}