This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix type inconsistency in array_type_nelts_top (PR c++/37417)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 9 Sep 2008 17:52:23 -0400
- Subject: [C++ PATCH] Fix type inconsistency in array_type_nelts_top (PR c++/37417)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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