This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ PATCH] Fix type inconsistency in array_type_nelts_top (PR c++/37417)


Hi!

The new gimple type verifier reports this, integer_one_node as
integer_type_node, not sizetype.  Will commit as obvious to trunk.

2008-09-09  Jakub Jelinek  <jakub@redhat.com>

	PR c++/37417
	* tree.c (array_type_nelts_top): Add size_one_node instead of
	integer_one_node.

	* g++.dg/ext/vla5.C: New test.

--- gcc/cp/tree.c.jj	2008-09-08 09:33:49.000000000 +0200
+++ gcc/cp/tree.c	2008-09-09 21:18:25.000000000 +0200
@@ -1461,7 +1461,7 @@ array_type_nelts_top (tree type)
 {
   return fold_build2 (PLUS_EXPR, sizetype,
 		      array_type_nelts (type),
-		      integer_one_node);
+		      size_one_node);
 }
 
 /* Return, as an INTEGER_CST node, the number of elements for TYPE
--- gcc/testsuite/g++.dg/ext/vla5.C.jj	2008-09-09 21:21:55.000000000 +0200
+++ gcc/testsuite/g++.dg/ext/vla5.C	2008-09-09 21:19:36.000000000 +0200
@@ -0,0 +1,10 @@
+// PR c++/37417
+// Testcase by Martin Michlmayr <tbm@cyrius.com>
+// { dg-do compile }
+// { dg-options "-O" }
+
+void
+test (int a)
+{
+  new (char[a]);
+}

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]