add new test
authorMichael Meissner <meissner@cygnus.com>
Thu, 28 Jan 1999 16:05:21 +0000 (16:05 +0000)
committerMichael Meissner <meissner@gcc.gnu.org>
Thu, 28 Jan 1999 16:05:21 +0000 (16:05 +0000)
From-SVN: r24897

gcc/testsuite/gcc.c-torture/ChangeLog
gcc/testsuite/gcc.c-torture/execute/990128-1.c [new file with mode: 0644]

index abecc17..3f160c5 100644 (file)
@@ -1,3 +1,7 @@
+1999-01-28  Michael Meissner  <meissner@cygnus.com>
+
+       * execute/990128-1.c: New test.
+
 1999-01-27  Michael Meissner  <meissner@cygnus.com>
 
        * execute/990127-{1,2}.c: New tests.
diff --git a/gcc/testsuite/gcc.c-torture/execute/990128-1.c b/gcc/testsuite/gcc.c-torture/execute/990128-1.c
new file mode 100644 (file)
index 0000000..cfdab3e
--- /dev/null
@@ -0,0 +1,50 @@
+extern int printf (const char *,...);
+
+struct s { struct s *n; } *p;
+struct s ss;
+#define MAX     10
+struct s sss[MAX];
+int count = 0;
+
+void sub( struct s *p, struct s **pp );
+int look( struct s *p, struct s **pp );
+
+main()
+{
+    struct s *pp;
+    struct s *next;
+    int i;
+
+    p = &ss;
+    next = p;
+    for ( i = 0; i < MAX; i++ ) {
+        next->n = &sss[i];
+        next = next->n;
+    }
+    next->n = 0;
+
+    sub( p, &pp );
+    if (count != MAX+2)
+      abort ();
+
+    exit( 0 );
+}
+
+void sub( struct s *p, struct s **pp )
+{
+   for ( ; look( p, pp ); ) {
+        if ( p )
+            p = p->n;
+        else
+            break;
+   }
+}
+
+int look( struct s *p, struct s **pp )
+{
+    for ( ; p; p = p->n )
+        ;
+    *pp = p;
+    count++;
+    return( 1 );
+}