aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMichael Meissner <meissner@cygnus.com>1999-01-28 16:05:21 +0000
committerMichael Meissner <meissner@gcc.gnu.org>1999-01-28 16:05:21 +0000
commit07b1b0304a88aa46e39208747b5438ffef317617 (patch)
tree6c382664db1ebfe40169701253c1127d3dd0fbe3 /gcc
parent5e5c976894845b293bd6684166e700e7e7113ad5 (diff)
downloadgcc-07b1b0304a88aa46e39208747b5438ffef317617.zip
gcc-07b1b0304a88aa46e39208747b5438ffef317617.tar.gz
gcc-07b1b0304a88aa46e39208747b5438ffef317617.tar.bz2
add new test
From-SVN: r24897
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.c-torture/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/990128-1.c50
2 files changed, 54 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/ChangeLog b/gcc/testsuite/gcc.c-torture/ChangeLog
index abecc170..3f160c5 100644
--- a/gcc/testsuite/gcc.c-torture/ChangeLog
+++ b/gcc/testsuite/gcc.c-torture/ChangeLog
@@ -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
index 0000000..cfdab3e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/990128-1.c
@@ -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 );
+}