diff mbox

Fix PR bootstrap/78493

Message ID fbf3e133-03a5-a218-6e3f-b97ca53cce1b@suse.cz
State New
Headers show

Commit Message

Martin Liška Nov. 24, 2016, 10 a.m. UTC
On 11/24/2016 10:09 AM, Jakub Jelinek wrote:
> On Thu, Nov 24, 2016 at 09:51:49AM +0100, Richard Biener wrote:

>> On Thu, Nov 24, 2016 at 9:36 AM, Jakub Jelinek <jakub@redhat.com> wrote:

>>> On Thu, Nov 24, 2016 at 09:26:25AM +0100, Richard Biener wrote:

>>>>> Alternately, given all the problems we have with this kind of problem, we

>>>>> should seriously consider throttling back what we consider an error during a

>>>>> profiled bootstrap.  This kind of stuff is a maintenance nightmare with

>>>>> minimal value.

>>>>

>>>> I think we've always communicated that all non-standard bootstrap configs

>>>> need -Wdisable-werror.

>>>

>>> Normal profiledbootstrap (when not using -O3 or similar) has been always

>>> -Werror clean and it would be nice if it stays so.

>>

>> Oh, this was just profiledbootstrap.  Agreed - though the proposed patch is

>> still too ugly for my taste.

> 

> Agreed on that.

> 

> 	Jakub

> 


Attaching second version of the patch which is preapproved by Jakub.
I'm going to install the patch as soon as it finishes regression tests.

Martin
diff mbox

Patch

From 9a39306855554d582f8cca1cc4172717585d4a15 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 23 Nov 2016 14:08:52 +0100
Subject: [PATCH] cp_parser_range_for: use safe_push instead of quick_push (PR
 bootstrap/78493)

gcc/cp/ChangeLog:

2016-11-24  Martin Liska  <mliska@suse.cz>

	PR bootstrap/78493
	* parser.c (cp_parser_range_for): Use safe_push instead of quick_push.

gcc/testsuite/ChangeLog:

2016-11-24  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/78493
	* g++.dg/cpp1z/decomp18.C: New test.
---
 gcc/cp/parser.c                       |  8 ++++----
 gcc/testsuite/g++.dg/cpp1z/decomp18.C | 12 ++++++++++++
 2 files changed, 16 insertions(+), 4 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/cpp1z/decomp18.C

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 9da4b30..843cbe2 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -11503,8 +11503,8 @@  cp_parser_range_for (cp_parser *parser, tree scope, tree init, tree range_decl,
 	      for (unsigned int i = 0; i < decomp_cnt; i++, d = DECL_CHAIN (d))
 		{
 		  tree name = DECL_NAME (d);
-		  names.quick_push (name);
-		  bindings.quick_push (IDENTIFIER_BINDING (name));
+		  names.safe_push (name);
+		  bindings.safe_push (IDENTIFIER_BINDING (name));
 		  IDENTIFIER_BINDING (name)
 		    = IDENTIFIER_BINDING (name)->previous;
 		}
@@ -11513,8 +11513,8 @@  cp_parser_range_for (cp_parser *parser, tree scope, tree init, tree range_decl,
       if (names.is_empty ())
 	{
 	  tree name = DECL_NAME (range_decl);
-	  names.quick_push (name);
-	  bindings.quick_push (IDENTIFIER_BINDING (name));
+	  names.safe_push (name);
+	  bindings.safe_push (IDENTIFIER_BINDING (name));
 	  IDENTIFIER_BINDING (name) = IDENTIFIER_BINDING (name)->previous;
 	}
     }
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp18.C b/gcc/testsuite/g++.dg/cpp1z/decomp18.C
new file mode 100644
index 0000000..d5c68a2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp18.C
@@ -0,0 +1,12 @@ 
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+struct A { char a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r; } a[64];
+
+void
+foo ()
+{
+  int z = 0;
+  for (auto & [ b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s ] : a)	// { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+    z += b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r + s;
+}
-- 
2.10.2