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]

Patch: more testcases from GNATS


This patch adds miscellaneous testcases from GNATS (some fixed, some
not) to the testsuite.  OK to commit?

2001-01-14  Joseph S. Myers  <jsm28@cam.ac.uk>

	* gcc.c-torture/compile/20010114-1.c: New test.
	* gcc.c-torture/compile/20010114-1.x: Xfail.
	* gcc.c-torture/compile/20010114-2.c: New test.
	* gcc.c-torture/execute/20010114-1.c: New test.
	* gcc.dg/trunc-1.c: New test.
	* gcc.dg/uninit-B.c: New test.

diff -ruN testsuite.orig/gcc.c-torture/compile/20010114-1.c testsuite/gcc.c-torture/compile/20010114-1.c
--- testsuite.orig/gcc.c-torture/compile/20010114-1.c	Thu Jan  1 00:00:00 1970
+++ testsuite/gcc.c-torture/compile/20010114-1.c	Sat Jan 13 23:55:38 2001
@@ -0,0 +1,5 @@
+/* Origin: PR c/166 from Joerg Czeranski <jc@joerch.org>.  */
+/* In the declaration of proc, x cannot be parsed as a typedef name,
+   so it must be parsed as a parameter name.  */
+typedef int x;
+void proc(int (*x)(void)) {}
diff -ruN testsuite.orig/gcc.c-torture/compile/20010114-1.x testsuite/gcc.c-torture/compile/20010114-1.x
--- testsuite.orig/gcc.c-torture/compile/20010114-1.x	Thu Jan  1 00:00:00 1970
+++ testsuite/gcc.c-torture/compile/20010114-1.x	Sun Jan 14 00:01:06 2001
@@ -0,0 +1,2 @@
+set torture_compile_xfail "*-*-*"
+return 0
diff -ruN testsuite.orig/gcc.c-torture/compile/20010114-2.c testsuite/gcc.c-torture/compile/20010114-2.c
--- testsuite.orig/gcc.c-torture/compile/20010114-2.c	Thu Jan  1 00:00:00 1970
+++ testsuite/gcc.c-torture/compile/20010114-2.c	Sat Jan 13 23:51:28 2001
@@ -0,0 +1,6 @@
+/* Origin: <URL:http://gcc.gnu.org/ml/gcc-patches/2000-12/msg01384.html>
+   from Fred Fish <fnf@geekgadgets.org>.  See also PR c/1625.  */
+
+#include <stdbool.h>
+
+struct { int x; bool y; } foo = { 0, false };
diff -ruN testsuite.orig/gcc.c-torture/execute/20010114-1.c testsuite/gcc.c-torture/execute/20010114-1.c
--- testsuite.orig/gcc.c-torture/execute/20010114-1.c	Thu Jan  1 00:00:00 1970
+++ testsuite/gcc.c-torture/execute/20010114-1.c	Sat Jan 13 23:47:50 2001
@@ -0,0 +1,15 @@
+/* Origin: PR c/1540 from Mattias Lampe <lampe@tu-harburg.de>,
+   adapted to a testcase by Joseph Myers <jsm28@cam.ac.uk>.
+   GCC 2.95.2 fails, CVS GCC of 2001-01-13 passes.  */
+extern void abort (void);
+extern void exit (int);
+
+int
+main (void)
+{
+  int array1[1] = { 1 };
+  int array2[2][1]= { { 1 }, { 0 } };
+  if (array1[0] != 1)
+    abort ();
+  exit (0);
+}
diff -ruN testsuite.orig/gcc.dg/trunc-1.c testsuite/gcc.dg/trunc-1.c
--- testsuite.orig/gcc.dg/trunc-1.c	Thu Jan  1 00:00:00 1970
+++ testsuite/gcc.dg/trunc-1.c	Sat Jan 13 23:58:22 2001
@@ -0,0 +1,15 @@
+/* Origin: PR c/675 from aj@suse.de.  */
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+#include <stddef.h>
+
+int
+main (void)
+{
+  size_t len;
+
+  len = ~(sizeof (size_t) - 1); /* { dg-bogus "truncated" "bogus truncation warning" } */
+
+  return 0;
+}
diff -ruN testsuite.orig/gcc.dg/uninit-B.c testsuite/gcc.dg/uninit-B.c
--- testsuite.orig/gcc.dg/uninit-B.c	Thu Jan  1 00:00:00 1970
+++ testsuite/gcc.dg/uninit-B.c	Sat Jan 13 23:57:45 2001
@@ -0,0 +1,15 @@
+/* Origin: PR c/179 from Gray Watson <gray@256.com>, adapted as a testcase
+   by Joseph Myers <jsm28@cam.ac.uk>.  */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized" } */
+extern void foo (int *);
+extern void bar (int);
+
+void
+baz (void)
+{
+  int i;
+  if (i) /* { dg-warning "uninit" "uninit i warning" { xfail *-*-* } } */
+    bar (i);
+  foo (&i);
+}

-- 
Joseph S. Myers
jsm28@cam.ac.uk


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