As discussed in the PR log, it seems difficult to simplify zero sized
arrays and keep gimple verification happy. Since this has only minor
effect on memory use, I am disabling it for GCC9 and will re-visit the
issue for GCC 10.

Bootstrapped/regtested x86_64-linux.

Honza

        PR lto/88140
        * tree.c (fld_simplified_type): Temporarily disable array
        simplification.

        * gcc.c-torture/pr88140.c: New testcase.
Index: tree.c
===================================================================
--- tree.c      (revision 267397)
+++ tree.c      (working copy)
@@ -5372,7 +5372,8 @@ fld_simplified_type (tree t, struct free
     return t;
   if (POINTER_TYPE_P (t))
     return fld_incomplete_type_of (t, fld);
-  if (TREE_CODE (t) == ARRAY_TYPE)
+  /* FIXME: This triggers verification error, see PR88140.  */
+  if (TREE_CODE (t) == ARRAY_TYPE && 0)
     return fld_process_array_type (t, fld_simplified_type (TREE_TYPE (t), fld),
                                   fld_simplified_types, fld);
   return t;
Index: testsuite/gcc.c-torture/pr88140.c
===================================================================
--- testsuite/gcc.c-torture/pr88140.c   (nonexistent)
+++ testsuite/gcc.c-torture/pr88140.c   (working copy)
@@ -0,0 +1,9 @@
+typedef struct {
+} a;
+
+typedef struct {
+  a *b[0];
+} c;
+
+void d() { ((c *)0)->b[0] = 0; }
+

Reply via email to