https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84632

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paolo.carlini at oracle dot com

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
If I test with the below - which in general makes sense to me - the ICE goes
away and the testsuite is mostly clean. The only differences are:
g++.dg/init/array21.C, array32.C, array43.C, array46.C. Only array32.C is a
real regression - we hit c++/72825 - the other are essentially improvements,
less redundant diagnostic (we would become rather similar to clang about these
testcases):

Index: decl.c
===================================================================
--- decl.c      (revision 258105)
+++ decl.c      (working copy)
@@ -5446,6 +5446,7 @@ maybe_deduce_size_from_array_init (tree decl, tree
              error_at (EXPR_LOC_OR_LOC (initializer,
                                         DECL_SOURCE_LOCATION (decl)),
                        "initializer fails to determine size of %qD", decl);
+             TREE_TYPE (decl) = error_mark_node;
            }
          else if (failure == 2)
            {
@@ -5453,6 +5454,7 @@ maybe_deduce_size_from_array_init (tree decl, tree
                {
                  error_at (DECL_SOURCE_LOCATION (decl),
                            "array size missing in %qD", decl);
+                 TREE_TYPE (decl) = error_mark_node;
                }
              /* If a `static' var's size isn't known, make it extern as
                 well as static, so it does not get allocated.  If it's not
@@ -5465,6 +5467,7 @@ maybe_deduce_size_from_array_init (tree decl, tree
            {
              error_at (DECL_SOURCE_LOCATION (decl),
                        "zero-size array %qD", decl);
+             TREE_TYPE (decl) = error_mark_node;
            }
        }

Reply via email to