[testsuite] i386 sibcall miscompilation

Jakub Jelinek jakub@redhat.com
Thu Jun 22 04:51:00 GMT 2000


Hi!

This testcase is miscompiled on i386 with -O2 (-O2 -fno-optimize-sibling-calls or
-O2 -fno-strict-aliasing cure it though).
The issue is that one of the arguments gets into alias set 6 (and all other
args are in alias set 5, including write to the same location to prepare
sibcall arguments) and the read from 16(%ebp) gets scheduled after the write
from the same location, eventhough we're interested in the old, not new,
value.
No fix yet.

2000-06-22  Jakub Jelinek  <jakub@redhat.com>

	* gcc.c-torture/execute/20000622-1.c: New test.

--- gcc/testsuite/gcc.c-torture/execute/20000622-1.c.jj	Thu Jun 22 13:33:08 2000
+++ gcc/testsuite/gcc.c-torture/execute/20000622-1.c	Thu Jun 22 12:42:29 2000
@@ -0,0 +1,21 @@
+long foo(long a, long b, long c)
+{
+  if (a != 12 || b != 1 || c != 11)
+    abort();
+  return 0;
+}
+long bar (long a, long b)
+{
+  return b;
+}
+void baz (long a, long b, void *c)
+{
+  long d;
+  d = (long)c;
+  foo(d, bar (a, 1), b);
+}
+int main()
+{
+  baz (10, 11, (void *)12);
+  exit(0);
+}

	Jakub


More information about the Gcc-patches mailing list