diff gcc/testsuite/gcc.dg/Warray-bounds-33.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-33.c	Thu Oct 25 07:37:49 2018 +0900
@@ -0,0 +1,36 @@
+/* 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." } */