public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ patch] PR tree-optimization/62053 (VLA arrays)
@ 2014-10-13 14:02 Jan Hubicka
  0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2014-10-13 14:02 UTC (permalink / raw)
  To: gcc-patches

Hi,
this patch triggers assert in tree-inline that verify that array type and its main variant have same size
(as pointer).  In this case we have two types that do have same size, but the expression is different.
It is created in both cases by layout_type becuase C++ FE calls layout_type before linking the variants.
I think it is safe to move the call and avoid the duplication.

Bootstrapped/regtested x86_64-linux, OK?

Honza

	PR tree-optimization/62053
	* g++.dg/torture/pr62053.C: New testcase.
	* tree.c: Avoid ordering issue with layout_type.

Index: testsuite/g++.dg/torture/pr62053.C
===================================================================
--- testsuite/g++.dg/torture/pr62053.C	(revision 0)
+++ testsuite/g++.dg/torture/pr62053.C	(revision 0)
@@ -0,0 +1,7 @@
+// { dg-do compile }
+typedef int GType;
+class YGTable
+{
+  YGTable () { GType a[m_fn1 ()]; }
+  int m_fn1 ();
+};
Index: cp/tree.c
===================================================================
--- cp/tree.c	(revision 216145)
+++ cp/tree.c	(working copy)
@@ -863,12 +863,12 @@ build_cplus_array_type (tree elt_type, t
 	{
 	  t = build_min_array_type (elt_type, index_type);
 	  set_array_type_canon (t, elt_type, index_type);
-	  if (!dependent)
-	    layout_type (t);
 
 	  TYPE_MAIN_VARIANT (t) = m;
 	  TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m);
 	  TYPE_NEXT_VARIANT (m) = t;
+	  if (!dependent)
+	    layout_type (t);
 	}
     }
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-10-13 13:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-13 14:02 [C++ patch] PR tree-optimization/62053 (VLA arrays) Jan Hubicka

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).