ipa/105598 - testcase for PR105598
authorRichard Biener <rguenther@suse.de>
Mon, 16 May 2022 09:21:06 +0000 (11:21 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 16 May 2022 10:04:15 +0000 (12:04 +0200)
2022-05-16  Richard Biener  <rguenther@suse.de>

gcc/testsuite/
* gcc.dg/torture/pr105598.c: New testcase.

(cherry picked from commit 6230911cb91d428631e741d7d981fab578102084)

gcc/testsuite/gcc.dg/torture/pr105598.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.dg/torture/pr105598.c b/gcc/testsuite/gcc.dg/torture/pr105598.c
new file mode 100644 (file)
index 0000000..0a4ea3b
--- /dev/null
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+
+typedef struct { unsigned int num; } info_t;
+typedef struct { unsigned int flag, type; } block_t;
+info_t info;
+block_t blocks[] = { {2,0}, {3,0}, {1,0}, {1,0} };
+
+static block_t *
+f (info_t *i, block_t *b)
+{
+  while (1) {
+    unsigned int is_last = b->flag & 0x01;
+    i->num++;
+    if (b->flag & 0x02) {
+      if (b->type != 0x1) b->type = b->type;
+      b = f (i, b+1);
+    }
+    if (is_last)
+      break;
+    b++;
+  }
+  return b;
+}
+
+int
+main ()
+{
+  f(&info, &blocks[0]);
+  if (info.num != 4)
+    __builtin_abort ();
+  return 0;
+}