From daaf6209a4b83e4fdd8a0b744833399169e282e9 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Mon, 13 Oct 2014 16:43:24 +0200 Subject: [PATCH] re PR c++/62127 (ICE with VLA in constructor) 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 | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/torture/pr62127.C | 11 +++++++++++ gcc/tree-inline.c | 2 ++ 4 files changed, 24 insertions(+) create mode 100644 gcc/testsuite/g++.dg/torture/pr62127.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9e35d69b486..36b5abb71c6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-10-13 Jan Hubicka + + PR tree-optimization/62127 + * tree.c (remap_type_1): When remapping array, remap + also its type. + 2014-10-13 Christophe Lyon * Makefile.in: (check-%): Update comment, as RUNTESTFLAGS no diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2134ada323d..c1dce8b89a4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-10-13 Jan Hubicka + + PR tree-optimization/62127 + * g++.dg/torture/pr62127.C: New testcase. + 2014-09-19 Marat Zakirov * 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 index 00000000000..7b83a264413 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr62127.C @@ -0,0 +1,11 @@ +// { dg-do compile } +struct A +{ + A(int); +}; + +A::A(int i) +{ + int x[1][i]; + x[0][0] = 0; +} diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 45838993602..a817989200e 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -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) { -- 2.30.2