public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] PR 84540 ("[6/7/8 Regression] ICE with alignas in variadic template")
@ 2018-02-26 16:56 Paolo Carlini
  2018-02-26 17:51 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Carlini @ 2018-02-26 16:56 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 479 bytes --]

Hi,

this regression is an ICE on valid, and seems rather easy to analyze: 
both apply_late_template_attributes and tsubst_attributes don't appear 
to cope correctly with tsubst_attribute returning NULL_TREE. That, in 
turn, seems normal for an empty pack - as in the testcases - given the 
structure of the last part of the latter, handling PACK_EXPANSION_P 
(val). I'm finishing testing on x86_64-linux (in libstdc++-v3, so far so 
good).

Thanks, Paolo.

///////////////////


[-- Attachment #2: CL_84540 --]
[-- Type: text/plain, Size: 357 bytes --]

/cp
2018-02-26  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/84540
	* pt.c (tsubst_attributes): Handle correctly tsubst_attribute
	returning NULL_TREE.
	(apply_late_template_attributes): Likewise.

/testsuite
2018-02-26  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/84540
	* g++.dg/cpp0x/alignas14.C: New.
	* g++.dg/cpp0x/alignas15.C: Likewise.

[-- Attachment #3: patch_84540 --]
[-- Type: text/plain, Size: 1430 bytes --]

Index: cp/pt.c
===================================================================
--- cp/pt.c	(revision 257989)
+++ cp/pt.c	(working copy)
@@ -10245,9 +10245,8 @@ tsubst_attributes (tree attributes, tree args,
 	    if (subst != t)
 	      {
 		*p = subst;
-		do
+		while (*p)
 		  p = &TREE_CHAIN (*p);
-		while (*p);
 		*p = TREE_CHAIN (t);
 		continue;
 	      }
@@ -10314,9 +10313,8 @@ apply_late_template_attributes (tree *decl_p, tree
 	      *p = TREE_CHAIN (t);
 	      TREE_CHAIN (t) = NULL_TREE;
 	      *q = tsubst_attribute (t, decl_p, args, complain, in_decl);
-	      do
+	      while (*q)
 		q = &TREE_CHAIN (*q);
-	      while (*q);
 	    }
 	  else
 	    p = &TREE_CHAIN (t);
Index: testsuite/g++.dg/cpp0x/alignas14.C
===================================================================
--- testsuite/g++.dg/cpp0x/alignas14.C	(nonexistent)
+++ testsuite/g++.dg/cpp0x/alignas14.C	(working copy)
@@ -0,0 +1,6 @@
+// PR c++/84540
+// { dg-do compile { target c++11 } }
+
+template<typename... T> struct alignas(alignof(T)...) A {};
+
+A<> a;
Index: testsuite/g++.dg/cpp0x/alignas15.C
===================================================================
--- testsuite/g++.dg/cpp0x/alignas15.C	(nonexistent)
+++ testsuite/g++.dg/cpp0x/alignas15.C	(working copy)
@@ -0,0 +1,6 @@
+// PR c++/84540
+// { dg-do compile { target c++11 } }
+
+template<typename... T> struct A { enum alignas(alignof(T)...) E {}; };
+
+A<> a;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [C++ Patch] PR 84540 ("[6/7/8 Regression] ICE with alignas in variadic template")
  2018-02-26 16:56 [C++ Patch] PR 84540 ("[6/7/8 Regression] ICE with alignas in variadic template") Paolo Carlini
@ 2018-02-26 17:51 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2018-02-26 17:51 UTC (permalink / raw)
  To: Paolo Carlini; +Cc: gcc-patches

OK.

On Mon, Feb 26, 2018 at 11:56 AM, Paolo Carlini
<paolo.carlini@oracle.com> wrote:
> Hi,
>
> this regression is an ICE on valid, and seems rather easy to analyze: both
> apply_late_template_attributes and tsubst_attributes don't appear to cope
> correctly with tsubst_attribute returning NULL_TREE. That, in turn, seems
> normal for an empty pack - as in the testcases - given the structure of the
> last part of the latter, handling PACK_EXPANSION_P (val). I'm finishing
> testing on x86_64-linux (in libstdc++-v3, so far so good).
>
> Thanks, Paolo.
>
> ///////////////////
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-26 17:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-26 16:56 [C++ Patch] PR 84540 ("[6/7/8 Regression] ICE with alignas in variadic template") Paolo Carlini
2018-02-26 17:51 ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).