[PATCH] Add testcases for two recently fixed P1s

Jakub Jelinek jakub@redhat.com
Wed Sep 5 10:28:00 GMT 2007


Hi!

These two P1 PRs were recently fixed by other changes, but the testcases
weren't committed.
Tested on x86_64-linux, i686-linux and ia64-linux with
make check-gcc RUNTESTFLAGS="dg.exp=pr32975* compile.exp=200709*"
plus additionally on x86_64-linux also with older cc1's
(rev 127488, 127491, 127637 and 127638) to see FAILs before the commits
and no FAILs after it.  Actually, 20070905-1.c test failed at -O1 and higher
with 127488, with 127491 -O1 and -Os cases were cured but only with
September, 3ish trunk all other options are fixed too, pr32975 failed
up to 127637 and succeeds with 127638+.

Ok for trunk?

2007-09-05  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/32772
	* gcc.c-torture/compile/20070905-1.c: New test.

	PR tree-optimization/32975
	* gcc.dg/pr32975.c: New test.

--- gcc/testsuite/gcc.c-torture/compile/20070905-1.c.jj	2007-09-05 11:59:50.000000000 +0200
+++ gcc/testsuite/gcc.c-torture/compile/20070905-1.c	2007-09-05 11:59:21.000000000 +0200
@@ -0,0 +1,34 @@
+/* PR tree-optimization/32772 */
+
+struct S
+{
+  unsigned long bits[1];
+};
+
+void f1 (int, unsigned long *);
+int f2 (void);
+int f3 (int, unsigned long *);
+int f4 (int, unsigned long *);
+
+static inline __attribute__ ((always_inline))
+void baz (int x, volatile struct S *y)
+{
+  f1 (x, y->bits);
+}
+
+static int
+bar (int x, struct S *y)
+{
+  int n;
+  if (__builtin_constant_p (x) ? f3 (x, y->bits) : f4 (x, y->bits))
+    baz (x, y);
+  for (n = f2 (); n < 8; n = f2 ())
+    f3 (n, y->bits);
+}
+
+void
+foo (int x, int y)
+{
+  struct S m;
+  while ((y = bar (x, &m)) >= 0);
+}
--- gcc/testsuite/gcc.dg/pr32975.c.jj	2007-09-05 12:06:23.000000000 +0200
+++ gcc/testsuite/gcc.dg/pr32975.c	2007-09-05 12:13:23.000000000 +0200
@@ -0,0 +1,23 @@
+/* PR tree-optimization/32975 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -finline-functions -fipa-cp" } */
+
+static int
+f0 (char *s0, char *s1)
+{
+  return __builtin_strlen (s0) > __builtin_strlen (s1);
+}
+
+int
+f1 (char *s, int j)
+{
+  if (f0 (s, ""))
+    return 1;
+  return j;
+}
+
+void
+f2 (char *s)
+{
+  f1 (s, 0);
+}

	Jakub



More information about the Gcc-patches mailing list