diff mbox

[committed] Fix ICE with C++11 attributes (PR c++/71739)

Message ID 20160704173506.GJ7387@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek July 4, 2016, 5:35 p.m. UTC
Hi!

We ICE with C++11 attributes, because their TREE_PURPOSE is not
IDENTIFIER_NODE, but TREE_LIST.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
committed to trunk and 6.2 as obvious.

2016-07-04  Jakub Jelinek  <jakub@redhat.com>

	PR c++/71739
	* tree.c (attribute_value_equal): Use get_attribute_name instead of
	directly using TREE_PURPOSE.

	* g++.dg/cpp0x/pr71739.C: New test.


	Jakub
diff mbox

Patch

--- gcc/tree.c.jj	2016-06-24 12:59:22.000000000 +0200
+++ gcc/tree.c	2016-07-04 11:17:48.425814493 +0200
@@ -5009,7 +5009,7 @@  attribute_value_equal (const_tree attr1,
       && TREE_CODE (TREE_VALUE (attr2)) == TREE_LIST)
     {
       /* Handle attribute format.  */
-      if (is_attribute_p ("format", TREE_PURPOSE (attr1)))
+      if (is_attribute_p ("format", get_attribute_name (attr1)))
 	{
 	  attr1 = TREE_VALUE (attr1);
 	  attr2 = TREE_VALUE (attr2);
--- gcc/testsuite/g++.dg/cpp0x/pr71739.C.jj	2016-07-04 11:19:16.629676012 +0200
+++ gcc/testsuite/g++.dg/cpp0x/pr71739.C	2016-07-04 11:18:56.000000000 +0200
@@ -0,0 +1,5 @@ 
+// PR c++/71739
+// { dg-do compile { target c++11 } }
+
+template <int N> struct alignas(N) A;
+template <int N> struct alignas(N) A {};