+2018-07-31 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/86741
+ * tree-vrp.c (vrp_prop::check_mem_ref): Avoid incomplete types.
+
2018-07-31 Andreas Krebbel <krebbel@linux.ibm.com>
* config/s390/s390.c (s390_expand_setmem): Make the unrolling to
+2018-07-31 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/86741
+ * gcc.dg/Warray-bounds-33.c: New test.
+
2018-07-31 Andreas Krebbel <krebbel@linux.ibm.com>
* gcc.target/s390/memset-1.c: Improve testcase.
--- /dev/null
+/* PR tree-optimization/86741 - ICE in -Warray-bounds indexing into
+ an object of incomplete type
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+struct S
+{
+ int s;
+};
+
+void f (void);
+
+void test_void (void)
+{
+ extern void v;
+ struct S *b = (struct S*)&v;
+ if (b->s)
+ f ();
+}
+
+void test_incomplete_enum (void)
+{
+ extern enum E e;
+ struct S *b = (struct S*)&e;
+ if (b->s)
+ f ();
+}
+
+void test_func (void)
+{
+ struct S *b = (struct S*)&f;
+ if (b->s)
+ f ();
+}
+
+/* { dg-prune-output "taking address of expression of type .void." } */
a reference/subscript via a pointer to an object that is not
an element of an array. References to members of structs and
unions are excluded because MEM_REF doesn't make it possible
- to identify the member where the reference originated. */
+ to identify the member where the reference originated.
+ Incomplete types are excluded as well because their size is
+ not known. */
tree reftype = TREE_TYPE (arg);
if (POINTER_TYPE_P (reftype)
+ || !COMPLETE_TYPE_P (reftype)
|| RECORD_OR_UNION_TYPE_P (reftype))
return;