This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Another typeof+asm test (was Re: typeof woes in symbol renaming, or glibc x gcc)


On Wed, Aug 14, 2002 at 06:42:09AM +0200, Andreas Jaeger wrote:
> > The solution I implemented that fixed the problem was to arrange for
> > typeof to enter skip_evaluation mode (I was surprised to find out it
> > didn't) and then arrange for no RTL or assembly code to be generated
> > for references that occur while in skip_evaluation mode.
> >
> > An earlier version of this patch, that only modified the C front-end,
> > passed bootstrap in IA64 (thanks, Jakub!).  Jakub also noticed that
> > the problem affected C++ too, and kindly wrote testcases for me
> > (thanks again! :-).  I've tested this patch myself on
> > athlon-pc-linux-gnu-x-mips-elf.
> >
> > Ok to install?
> 
> Is this something for 3.2.1?  Or does it only fail on mainline?

It fails in 3.2.x and failed in various ways in the past compilers too,
that's why glibc has checks for this in its configury and only optimizes
if all works as expected.
IMHO it should be something for 3.2.1 too.
I think backport of __attribute__((visibility())) stuff would be
useful too.

Below is another testcase to test typeof+asm behaviour glibc relies on.
Ok to commit?

2002-08-14  Jakub Jelinek  <jakub@redhat.com>

	* gcc.dg/typeof-2.c: New test.

--- gcc/testsuite/gcc.dg/typeof-2.c.jj	2002-08-08 20:42:33.000000000 +0200
+++ gcc/testsuite/gcc.dg/typeof-2.c	2002-08-08 20:47:53.000000000 +0200
@@ -0,0 +1,29 @@
+/* Test typeof with __asm redirection. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+extern int foo1 (int x) __asm ("baz1");
+int bar1 (int x) { return x; }
+extern __typeof (bar1) foo1 __attribute ((weak, alias ("bar1")));
+
+extern int foo2 (int x) __attribute__ ((const));
+extern __typeof (foo2) foo2 __asm ("baz2");
+int bar2 (int x)
+{
+  return foo2 (x) + foo2 (x) + foo2 (x) + foo2 (x) + foo2 (x) + foo2 (x);
+}
+
+extern int foo3 (int x);
+extern __typeof (foo3) foo3 __asm ("baz3");
+int bar3 (int x)
+{
+  return foo3 (x) + foo3 (x) + foo3 (x) + foo3 (x) + foo3 (x) + foo3 (x);
+}
+
+// { dg-final { scan-assembler-not "foo1" } }
+// { dg-final { scan-assembler "baz1" } }
+// { dg-final { scan-assembler-not "foo2" } }
+// { dg-final { scan-assembler "baz2" } }
+// { dg-final { scan-assembler-not "baz2.*baz2.*baz2.*baz2.*baz2.*baz2" } }
+// { dg-final { scan-assembler-not "foo3" } }
+// { dg-final { scan-assembler "baz3.*baz3.*baz3.*baz3.*baz3.*baz3" } }

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]