diff options
author | David Malcolm <dmalcolm@redhat.com> | 2020-08-20 17:50:14 -0400 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2020-08-20 21:15:05 -0400 |
commit | 6b31b6b52612a6d4a7a84e71f6331464d68400d4 (patch) | |
tree | 8f88cff480d85719928d5f8847725ec64c717fec | |
parent | 5b9a3d2a0545f0ba118d74aca30b60689d31f387 (diff) | |
download | gcc-6b31b6b52612a6d4a7a84e71f6331464d68400d4.zip gcc-6b31b6b52612a6d4a7a84e71f6331464d68400d4.tar.gz gcc-6b31b6b52612a6d4a7a84e71f6331464d68400d4.tar.bz2 |
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.
-rw-r--r-- | gcc/testsuite/gcc.dg/analyzer/pr95152-4.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/analyzer/pr95152-5.c | 6 |
2 files changed, 17 insertions, 0 deletions
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 0000000..f2a72ca --- /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 0000000..604b784 --- /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; +} |