analyzer: add test coverage for fixed ICE [PR94047]
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 10 Mar 2020 22:50:03 +0000 (18:50 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Wed, 18 Mar 2020 13:59:17 +0000 (09:59 -0400)
PR analyzer/94047 reports an ICE, which turned out to be caused
by the erroneous use of TREE_TYPE on the view region's type
in region_model::get_representative_path_var that I introduced
in r10-7024-ge516294a1acb28aaaad44cfd583cc6a80354044e and
fixed in g:787477a226033e36be3f6d16b71be13dd917e982.

This patch adds a regression test for the ICE.

gcc/testsuite/ChangeLog:
PR analyzer/94047
* gcc.dg/analyzer/pr94047.c: New test.

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/analyzer/pr94047.c [new file with mode: 0644]

index 4aa798f8a48cfb95b0a654344be0482adc687804..a91d7377888684d75e3400b14386f0a449fb222a 100644 (file)
@@ -1,3 +1,8 @@
+2020-03-18  David Malcolm  <dmalcolm@redhat.com>
+
+       PR analyzer/94047
+       * gcc.dg/analyzer/pr94047.c: New test.
+
 2020-03-18   Richard Biener  <rguenther@suse.de>
 
        PR middle-end/94206
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr94047.c b/gcc/testsuite/gcc.dg/analyzer/pr94047.c
new file mode 100644 (file)
index 0000000..d989a25
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-additional-options "-Wno-analyzer-too-complex" } */
+/* TODO: the above ought not to be necessary, but currently is due to a
+   state explosion within the for loop.  */
+
+typedef struct list
+{
+  struct list *next;
+} tlist;
+
+void
+bar (struct list *l)
+{
+  l->next = l->next->next;
+}
+
+void
+foo (void)
+{
+  struct list l;
+  tlist t = l;
+  for (;;)
+    bar (&t);
+}