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 9e35d69..36b5abb 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 2134ada..c1dce8b 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 4583899..a817989 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)
        {