re PR c++/62127 (ICE with VLA in constructor)
authorJan Hubicka <hubicka@ucw.cz>
Mon, 13 Oct 2014 14:43:24 +0000 (16:43 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 13 Oct 2014 14:43:24 +0000 (14:43 +0000)
PR tree-optimization/62127
* g++.dg/torture/pr62127.C: New testcase.
* tree.c (remap_type_1): When remapping array, remap
also its type.

From-SVN: r216150

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr62127.C [new file with mode: 0644]
gcc/tree-inline.c

index 9e35d69b486ff9dfca7da1bbbb8a6be8dd10be7a..36b5abb71c63dc77988341adf6ef5185fee3fddf 100644 (file)
@@ -1,3 +1,9 @@
+2014-10-13  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR tree-optimization/62127
+       * tree.c (remap_type_1): When remapping array, remap
+       also its type.
+
 2014-10-13  Christophe Lyon  <christophe.lyon@linaro.org>
 
        * Makefile.in: (check-%): Update comment, as RUNTESTFLAGS no
index 2134ada323d4cb1a92a9dd7d489e6cf2a9145a31..c1dce8b89a4c7611a9468610094592af92fd3ef5 100644 (file)
@@ -1,3 +1,8 @@
+2014-10-13  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR tree-optimization/62127
+       * g++.dg/torture/pr62127.C: New testcase.
+
 2014-09-19  Marat Zakirov  <m.zakirov@samsung.com>
 
        * c-c++-common/asan/bitfield-5.c: New test.
diff --git a/gcc/testsuite/g++.dg/torture/pr62127.C b/gcc/testsuite/g++.dg/torture/pr62127.C
new file mode 100644 (file)
index 0000000..7b83a26
--- /dev/null
@@ -0,0 +1,11 @@
+// { dg-do compile }
+struct A
+{
+  A(int);
+};
+
+A::A(int i)
+{
+  int x[1][i];
+  x[0][0] = 0;
+}
index 458389936029b1a3ee72605d18d96cbb9734b1af..a817989200e7fa2f4a0e0acdfc318bf9ddb37a59 100644 (file)
@@ -496,6 +496,8 @@ remap_type_1 (tree type, copy_body_data *id)
       if (TYPE_MAIN_VARIANT (new_tree) != new_tree
          && TREE_TYPE (type) == TREE_TYPE (TYPE_MAIN_VARIANT (type)))
        TREE_TYPE (new_tree) = TREE_TYPE (TYPE_MAIN_VARIANT (new_tree));
+      else
+       TREE_TYPE (new_tree) = remap_type (TREE_TYPE (new_tree), id);
 
       if (TYPE_MAIN_VARIANT (new_tree) != new_tree)
        {