]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
This commit was manufactured by cvs2svn to create branch
authorNo Author <no-author@gcc.gnu.org>
Wed, 10 Nov 2004 17:29:11 +0000 (17:29 +0000)
committerNo Author <no-author@gcc.gnu.org>
Wed, 10 Nov 2004 17:29:11 +0000 (17:29 +0000)
'gcc-3_4-branch'.

From-SVN: r90397

gcc/testsuite/gcc.dg/func-outside-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/func-outside-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/union-2.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.dg/func-outside-1.c b/gcc/testsuite/gcc.dg/func-outside-1.c
new file mode 100644 (file)
index 0000000..61c343b
--- /dev/null
@@ -0,0 +1,9 @@
+/* Test for rejection of __func__ outside a function (GNU extensions
+   are OK there).  Test with no special options.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+const char *a = __func__; /* { dg-warning "warning: '__func__' is not defined outside of function scope" "undef" } */
+const char *b = __FUNCTION__;
+const char *c = __PRETTY_FUNCTION__;
diff --git a/gcc/testsuite/gcc.dg/func-outside-2.c b/gcc/testsuite/gcc.dg/func-outside-2.c
new file mode 100644 (file)
index 0000000..60a6c14
--- /dev/null
@@ -0,0 +1,9 @@
+/* Test for rejection of __func__ outside a function (GNU extensions
+   are OK there).  Test with -pedantic-errors.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors" } */
+
+const char *a = __func__; /* { dg-error "error: '__func__' is not defined outside of function scope" "undef" } */
+const char *b = __FUNCTION__;
+const char *c = __PRETTY_FUNCTION__;
diff --git a/gcc/testsuite/gcc.dg/union-2.c b/gcc/testsuite/gcc.dg/union-2.c
new file mode 100644 (file)
index 0000000..edc8a7a
--- /dev/null
@@ -0,0 +1,28 @@
+/* This used to segfault on SPARC 64-bit at runtime because
+   the stack pointer was clobbered by the function call.   */
+
+/* { dg-do run } */
+
+#include <stdarg.h>
+
+union U
+{
+  long l1[2];
+};
+
+union U u;
+
+void foo (int z, ...)
+{
+  int i;
+  va_list ap;
+  va_start(ap,z);
+  i = va_arg(ap, int);
+  va_end(ap);
+}
+
+int main(void)
+{
+  foo (1, 1, 1, 1, 1, u);
+  return 0;
+}