]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c++/12696 (memory eating infinite loop in diagnostics)
authorGabriel Dos Reis <gdr@integrable-solutions.net>
Fri, 26 Dec 2003 04:06:45 +0000 (04:06 +0000)
committerGabriel Dos Reis <gdr@gcc.gnu.org>
Fri, 26 Dec 2003 04:06:45 +0000 (04:06 +0000)
Backport from mainline:
2003-12-16  Mark Mitchell  <mark@codesourcery.com>

        PR c++/12696
        * decl.c (reshape_init): Recover quickly from errors.

From-SVN: r75032

gcc/cp/ChangeLog
gcc/cp/decl.c

index e504ea4f8f4f11236c825a9f8d351996201dd794..bc456189b51426d5040f296bcf4afd93cba7980e 100644 (file)
@@ -1,3 +1,11 @@
+2003-12-26  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+
+       Backport from mainline:
+       2003-12-16  Mark Mitchell  <mark@codesourcery.com>
+
+        PR c++/12696
+        * decl.c (reshape_init): Recover quickly from errors.
+       
 2003-12-26  Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
        Backport from mainline:
index 697b195cd8ae7f97ae05a0b02d97b19d7fc7e3c8..48de213b73d699337fcd6e7023b497a57530478a 100644 (file)
@@ -8309,8 +8309,11 @@ reshape_init (tree type, tree *initp)
                 empty class shall have the form of an empty
                 initializer-list {}.  */
              if (!brace_enclosed_p)
-               error ("initializer for `%T' must be brace-enclosed",
-                      type);
+                {
+                  error ("initializer for `%T' must be brace-enclosed",
+                         type);
+                  return error_mark_node;
+                }
            }
          else
            {
@@ -8335,6 +8338,8 @@ reshape_init (tree type, tree *initp)
                    break;
 
                  field_init = reshape_init (TREE_TYPE (field), initp);
+                  if (field_init == error_mark_node)
+                    return error_mark_node;
                  TREE_CHAIN (field_init) = CONSTRUCTOR_ELTS (new_init);
                  CONSTRUCTOR_ELTS (new_init) = field_init;
                  /* [dcl.init.aggr] 
@@ -8365,6 +8370,8 @@ reshape_init (tree type, tree *initp)
              tree element_init;
 
              element_init = reshape_init (TREE_TYPE (type), initp);
+              if (element_init == error_mark_node)
+                return error_mark_node;
              TREE_CHAIN (element_init) = CONSTRUCTOR_ELTS (new_init);
              CONSTRUCTOR_ELTS (new_init) = element_init;
              if (TREE_PURPOSE (element_init))