re PR target/37170 (gcc.dg/weak/weak-1.c)
authorHans-Peter Nilsson <hp@gcc.gnu.org>
Mon, 22 Sep 2008 01:54:41 +0000 (01:54 +0000)
committerHans-Peter Nilsson <hp@gcc.gnu.org>
Mon, 22 Sep 2008 01:54:41 +0000 (01:54 +0000)
PR middle-end/37170
PR middle-end/37280
* gcc.dg/weak/weak-15.c, gcc.dg/weak/weak-16.c,
g++.dg/ext/inline1.C: New tests.

From-SVN: r140540

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/inline1.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/weak/weak-15.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/weak/weak-16.c [new file with mode: 0644]

index 370a370..ca0e708 100644 (file)
@@ -1,3 +1,10 @@
+2008-09-22  Hans-Peter Nilsson  <hp@axis.com>
+
+       PR middle-end/37170
+       PR middle-end/37280
+       * gcc.dg/weak/weak-15.c, gcc.dg/weak/weak-16.c,
+       g++.dg/ext/inline1.C: New tests.
+
 2008-09-21  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        PR rtl-optimization/33642
        * gfortran.dg/cshift_char_3.f90:  New test case.
        * gfortran.dg/cshift_nan_1.f90:  New test case.
 
-2008-08-14  Rafael Ã\81vila de Espíndola  <espindola@google.com>
+2008-08-14  Rafael Ã\83Â\81vila de EspÃ\83­ndola  <espindola@google.com>
 
        * gcc.dg/visibility-14.c: New test.
        * gcc.dg/visibility-15.c: New test.
        PR tree-optimization/36967
        * gfortran.dg/pr36967.f: New testcase.
 
-2008-07-30  Rafael Ã\81vila de Espíndola  <espindola@google.com>
+2008-07-30  Rafael Ã\83Â\81vila de EspÃ\83­ndola  <espindola@google.com>
 
        * gcc.dg/visibility-14.c: New test.
        * gcc.dg/visibility-15.c: New test.
        dg-additional-sources.
        (profopt-execute): Handle additional sources.
 
-2008-05-28  Rafael Espíndola  <espindola@google.com>
+2008-05-28  Rafael EspÃ\83­ndola  <espindola@google.com>
 
        * gcc.dg/20080528-1.c: New test.
 
        * g++.dg/template/inline1.C: For the not-defined symbol, use the
        pattern from g++.dg/template/qualttp17.C.
 
-2008-05-23  Rafael Espíndola  <espindola@google.com>
+2008-05-23  Rafael EspÃ\83­ndola  <espindola@google.com>
 
        * gcc.c-torture/compile/20080522-1.c: Move to gcc.dg.
        * gcc.dg/20080522-1.c: Moved from gcc.c-torture.
        * gfortran.dg/cshift_large_1.f90:  New test.
        * gfortran.dg/eoshift_large_1.f90:  New test.
 
-2008-05-22  Rafael Espíndola  <espindola@google.com>
+2008-05-22  Rafael EspÃ\83­ndola  <espindola@google.com>
 
        * gcc.c-torture/compile/20080522-1.c: New testcase.
 
        PR fortran/36162
        * gfortran.dg/module_widestring_1.f90: New test.
 
-2008-05-08  Rafael Espíndola  <espindola@google.com>
+2008-05-08  Rafael EspÃ\83­ndola  <espindola@google.com>
 
        * gcc.dg/vect/vect-111.c: Rename to no-trapping-math-vect-111.c
        * gcc.dg/vect/vect-ifcvt-11.c: Rename to no-trapping-math-vect-ifcvt-11.c
        PR fortran/35780
        * gfortran.dg/simplify_argN_1.f90: New test.
 
-2008-04-06  Tobias Schlüter  <tobi@gcc.gnu.org>
+2008-04-06  Tobias SchlÃ\83¼ter  <tobi@gcc.gnu.org>
 
        PR fortran/35832
        * gfortran.dg/io_constraints_2.f90: Adapt to new error message.
        * g++.dg/torture/pr35164-1.C: New testcase.
        * g++.dg/torture/pr35164-2.C: Likewise.
 
-2008-02-15  Dominique d'Humières  <dominiq@lps.ens.fr>
+2008-02-15  Dominique d'HumiÃ\83¨res  <dominiq@lps.ens.fr>
 
        PR testsuite/35119
        * g++.dg/template/spec35.C: Change the regular expressions
diff --git a/gcc/testsuite/g++.dg/ext/inline1.C b/gcc/testsuite/g++.dg/ext/inline1.C
new file mode 100644 (file)
index 0000000..7e5f062
--- /dev/null
@@ -0,0 +1,34 @@
+// { dg-do compile }
+// { dg-options "-O" }
+// Make sure inlined non-outlined functions aren't marked weak.
+// We'd get a ".weak xyzzy" annotation trigged by the second declaration.
+
+// { dg-final { scan-assembler-not "weak\[^ \t\]*\[ \t\]_?xyzzy" } } 
+
+// The next check isn't really part of the actual test, just to make
+// sure there's no outline-copy of xyzzy, because if that really
+// happened, it *should* be marked linkonce or perhaps weak.
+// { dg-final { scan-assembler-not "xyzzy" } } 
+
+extern int x;
+extern void foo(void);
+extern void bar(void);
+
+extern "C" inline int xyzzy(int a)
+{
+  foo();
+  return a + x;
+}
+
+extern "C" int xyzzy(int);
+
+extern inline int plugh(int c)
+{
+  return xyzzy (c);
+}
+
+int y;
+void doit(int b)
+{
+  y = xyzzy (b) + plugh (b);
+}
diff --git a/gcc/testsuite/gcc.dg/weak/weak-15.c b/gcc/testsuite/gcc.dg/weak/weak-15.c
new file mode 100644 (file)
index 0000000..2218ca4
--- /dev/null
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-require-weak "" } */
+/* { dg-options "-fno-common" } */
+
+/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?a" } } */
+/* { dg-final { scan-assembler-not "weak\[^ \t\]*\[ \t\]_?b" } } */
+/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?c" } } */
+/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?d" } } */
+
+#pragma weak a
+extern char a[];
+
+char *user_a(void)
+{
+  return a+1;
+}
+
+int x;
+int extern inline b(int y)
+{
+  return x+y;
+}
+
+extern int b(int y);
+
+int user_b(int z)
+{
+  return b(z);
+}
+
+#pragma weak c
+extern int c;
+
+int *user_c = &c;
+
+#pragma weak d
+extern char d[];
+
+char *user_d = &d[1];
diff --git a/gcc/testsuite/gcc.dg/weak/weak-16.c b/gcc/testsuite/gcc.dg/weak/weak-16.c
new file mode 100644 (file)
index 0000000..3bcf388
--- /dev/null
@@ -0,0 +1,21 @@
+/* From PR37280.  */
+/* { dg-do compile } */
+/* { dg-require-weak "" } */
+/* { dg-options "-fno-common -Os" } */
+/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?kallsyms_token_index" } } */
+/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?kallsyms_token_table" } } */
+
+extern int kallsyms_token_index[] __attribute__((weak));
+extern int kallsyms_token_table[] __attribute__((weak));
+void kallsyms_expand_symbol(int *result)
+{
+  int len = *result;
+  int *tptr;
+  while(len) {
+    tptr = &kallsyms_token_table[ kallsyms_token_index[*result] ];
+    len--;
+    while (*tptr) tptr++;
+    *tptr = 1;
+  }
+ *result = 0;
+}