public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/c++-modules] analyzer: add regression tests [PR95152]
@ 2020-08-28 15:58 Nathan Sidwell
  0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2020-08-28 15:58 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:6b31b6b52612a6d4a7a84e71f6331464d68400d4

commit 6b31b6b52612a6d4a7a84e71f6331464d68400d4
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Thu Aug 20 17:50:14 2020 -0400

    analyzer: add regression tests [PR95152]
    
    PR analyzer/95152 reports various ICEs in
    region_model::get_or_create_mem_ref.
    
    I removed this function as part of the state rewrite in
    r11-2694-g808f4dfeb3a95f50f15e71148e5c1067f90a126d.
    I've verified that these two test cases reproduce the issue with 10.2
    and don't ICE with trunk; adding them as regression tests.
    
    gcc/testsuite/ChangeLog:
            PR analyzer/95152
            * gcc.dg/analyzer/pr95152-4.c: New test.
            * gcc.dg/analyzer/pr95152-5.c: New test.

Diff:
---
 gcc/testsuite/gcc.dg/analyzer/pr95152-4.c | 11 +++++++++++
 gcc/testsuite/gcc.dg/analyzer/pr95152-5.c |  6 ++++++
 2 files changed, 17 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/analyzer/pr95152-4.c b/gcc/testsuite/gcc.dg/analyzer/pr95152-4.c
new file mode 100644
index 00000000000..f2a72cad01c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr95152-4.c
@@ -0,0 +1,11 @@
+/* { dg-additional-options "-Wno-pointer-to-int-cast" } */
+extern void my_func (int);
+typedef struct {
+  int var;
+} info_t;
+extern void *_data_offs;
+void test()
+{
+  info_t *info = ((void *)((void *)1) + ((unsigned int)&_data_offs));
+  my_func(info->var == 0);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr95152-5.c b/gcc/testsuite/gcc.dg/analyzer/pr95152-5.c
new file mode 100644
index 00000000000..604b78458c7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr95152-5.c
@@ -0,0 +1,6 @@
+/* { dg-additional-options "-Wno-incompatible-pointer-types" } */
+void foo(void)
+{
+  void (*a[1]) ();
+  void (*p) () = a + 1;
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-28 15:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28 15:58 [gcc/devel/c++-modules] analyzer: add regression tests [PR95152] Nathan Sidwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).